-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow multi value headers #35
Comments
👍 Do you think it could make sense to add a new method like |
@mnapoli I think I'll go with the PSR standard and also implement So in the end: public function getHeaders() : array # two-dimensional as state above
public function getHeader(string $headerKey) : array # 1-dimensional containing all values of the header
public function getHeaderLine(string $headerKey) : string # all values separated with comma |
👍 makes sense! |
hollodotme
added a commit
that referenced
this issue
Apr 29, 2019
* Add Response#getHeaderLine() to retrieve headers as string * Change return type of Response#getHeader() to array * Change return value of Response#getHeaders() to 2-dimensional array * Add & adjust tests
hollodotme
added a commit
that referenced
this issue
Apr 29, 2019
If headers with multiple values use header keys of different letter-case they will also be grouped when retrieved via getHeader() or getHeaderLine(), but the original headers (case-sensitive) are kept in the result of getHeaders().
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
Response#getHeaders()
will return a two-dimensional array like this:Response#getHeader($headerKey)
will return a flat array with all values for the given key.A call to a new method
Response#getHeaderLine($headerKey)
will return all values, separated by comma, for the given key.The results of
Response#getHeader($headerKey)
andResponse#getHeaderLine($headerKey)
will be the same for given keys in different case. (case-insensitive keys are accepted)Actual Behavior
Response#getHeaders()
will return a flat key-value array and provide only the last value of a multi-value header.Currently a call to
Response#getHeader($headerKey)
will return a string containing the last value for the given key.A method
Response#getHeaderLine($headerKey)
does not exist.Header keys are currently case-sensitive in
Response#getHeader($headerKey)
.Steps to Reproduce the Problem
Response#getHeaders()
orResponse#getHeader('Set-Cookie')
respectively.Specifications
<=2.7.0
ALL
ALL
Further comments
Changing the return type of
Response#getHeaders()
andResponse#getHeader($headerKey)
toarray
is a BC break and requires a new major version.Proposed version:
3.0.0
The text was updated successfully, but these errors were encountered: