WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#37168 closed defect (bug) (invalid)

wp_remote_post headers being set to lowercase

Reported by: dsifford Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: HTTP API Keywords:
Focuses: Cc:

Description

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
$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?

Change History (2)

#1 @dsifford
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Disregard -- I think it's my server that's normalizing the headers.

#2 @swissspidy
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.