Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#40347 closed defect (bug) (fixed)

WP_REST_Request::remove_header() does not canonicalize header name

Reported by: timothyblynjacobs's profile TimothyBlynJacobs Owned by: joehoyle's profile joehoyle
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:

Description

$request->add_header( 'Content-Type', 'application/json' );
$request->remove_header( 'Content-Type' );
$request->get_header( 'Content-Type' ); // still outputs 'application/json'

Patch incoming.

Attachments (1)

40347.diff (1.3 KB) - added by TimothyBlynJacobs 8 years ago.

Download all attachments as: .zip

Change History (4)

#1 @TimothyBlynJacobs
8 years ago

  • Keywords has-patch has-unit-tests added

#2 @swissspidy
8 years ago

  • Milestone changed from Awaiting Review to 4.8

#3 @joehoyle
8 years ago

  • Owner set to joehoyle
  • Resolution set to fixed
  • Status changed from new to closed

In 40577:

REST API: WP_REST_Request::remove_header() should canonicalize header names.

When headers are stored in WP_REST_Request internally they are canonicalized. This step already happens on setting / getting headers in any way, but was missed when implementing remove_header().

Props TimothyBlynJacobs.
Fixes #40347.

Note: See TracTickets for help on using tickets.