Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Add handling for array values in response headers#401

Open
SlimDeluxe wants to merge 1 commit intophp-vcr:masterfrom
DataLinx:handle-header-arrays
Open

FIX: Add handling for array values in response headers#401
SlimDeluxe wants to merge 1 commit intophp-vcr:masterfrom
DataLinx:handle-header-arrays

Conversation

@SlimDeluxe
Copy link

Context

The problem exists with servers that return duplicate headers. It's true that they should fix their own stuff, but it's also of interest that this package is resilient to such edge cases that appear in production.

What has been done

  • Fixed Response.php so that array as a value for any header is handled without errors.
  • Made sure Response::getContentType still works if Content-Type is received as an array. It returns the first value of the array.
  • Added 2 tests.

How to test

composer test

Two new tests have been added to confirm that arrays as values in headers are properly handled. Changes in the Response class ensure that the getContentType and getHeader methods correctly handle header values that are arrays, by returning either the first element of the array (for the getContentType method) or the entire array (for the getHeader method).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant