Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant