[wp-trac] [WordPress Trac] #37168: wp_remote_post headers being set to lowercase

WordPress Trac noreply at wordpress.org
Fri Jun 24 21:14:33 UTC 2016


#37168: wp_remote_post headers being set to lowercase
--------------------------+-----------------------------
 Reporter:  dsifford      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  HTTP API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Not sure if this is a known feature (it's not in the documentation
 anywhere that I could find), but if I set an all-caps header key in the
 args that I give to wp_remote_post, the header is converted to all
 lowercase.

 So, for example:

 {{{#!php
 <?php
 $response = wp_remote_post("https://my-api.com/endpoint", array(
   'headers' => array(
     'MY_API_KEY' => 'value',
    ),
    'body' => array(
      'foo' => 'bar',
     ),
 ));
 }}}

 results in...

 {{{
 my_api_key: 'value'
 }}}

 (along with the other default headers)



 Any ideas?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37168>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list