[wp-trac] [WordPress Trac] #14348: If it's a HEAD request, stop after the head!

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 16 09:25:38 UTC 2012


#14348: If it's a HEAD request, stop after the head!
---------------------------------------------+------------------
 Reporter:  mitchoyoshitaka                  |       Owner:
     Type:  enhancement                      |      Status:  new
 Priority:  normal                           |   Milestone:  3.5
Component:  Performance                      |     Version:  3.0
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch 3.5-early 2nd-opinion  |
---------------------------------------------+------------------

Comment (by mbijon):

 @kurtpayne, I think the command line is irrelevant to request type in
 testing. Unit tests mock browser requests. The test suite creates mocked
 GET and POST requests from the command line without added actions for each
 possible request. HEAD shouldn't be any different.

 THE PROBLEM: ... with WP testing seems to be that not all our verbs are
 built yet. We only have tests/post.php and tests/query.php for,
 respectively, POST and GET (& not 100% in query.php). And, note there's no
 head.php at all yet.

 POSSIBLE FIX: WP has {{{wp_remote_head()}}} built just for generating HEAD
 requests. So instead of adding the extra {{{do_action( 'head_request' )}}}
 we should be able to generate a HEAD request with {{{wp_remote_head( $url
 )}}} (check how it's done in tests/http/functions.php).

 I think a switch to wp_remote_head() in your test would create a more
 realistic test of what HEAD does, remove the need for spaghetti, and mean
 we can move the body of your {{{handle_head_request()}}} back into
 template-loader.php.

 @mitcho, would that fix your 1st concern in comment 39?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14348#comment:43>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list