-
Notifications
You must be signed in to change notification settings - Fork 301
Solves issue #170: HTTP Header parsing is inconsistent #182
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
Conversation
Response\Headers lowercases header names.
Before header names were only lowercased when created by fromString.
@@ -464,7 +464,7 @@ function testMultiHeaders() | |||
$req = Request::init(); | |||
$response = new Response(self::SAMPLE_JSON_RESPONSE, self::SAMPLE_MULTI_HEADER, $req); | |||
$parse_headers = $response->_parseHeaders(self::SAMPLE_MULTI_HEADER); | |||
$this->assertEquals('Value1,Value2', $parse_headers['X-My-Header']); | |||
$this->assertEquals('Value1,Value2', $parse_headers['x-my-header']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This means that this will be a breaking change. Code that relied on the capitalization will break. Can we keep this backwards compatible and keep the capitalization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The culprit is the upstream implementation of Response\Headers::fromString. There the keys are stored lower case. I retained that behavior, and so had to change the test.
Should I drop the lower case?
How should I handle the lower case problem? |
Hi there. How should I handle the lower case problem? |
I removed the lower case code and reverted the test |
I just fixed all the issues. Headers remain as entered. |
Is there any intereset oin this pull request by upstream? |
Absolutely. |
This push request solves issue #170 by moving the code from Response::_parseCode to Response\Headers::fromString.