-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Add cookies to request object #175
Conversation
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.
Nice!
The RFC suggests that there must be a space between multiple cookie-pairs, such as Cookie: SID=31d4d96e407aad42; lang=en-US
. Can you verify https://tools.ietf.org/html/rfc6265#section-4.2.1?
@clue you're right about the space between multiple cookies. Fixed it. |
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.
Changes LGTM, thanks! 👍
The RFC suggests there MUST be space after the semicolon, are clients that omit this space relevant? May I ask you to check how other parsers handle this situation? 👍
d736267
to
3974e62
Compare
src/ServerRequest.php
Outdated
*/ | ||
public static function parseCookie($cookie) | ||
{ | ||
// PSR-7 `getHeadline('Cookies')` will return multiple |
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.
should be getHeaderLine
src/ServerRequest.php
Outdated
public static function parseCookie($cookie) | ||
{ | ||
// PSR-7 `getHeadline('Cookies')` will return multiple | ||
// cookie header coma-seperated. Multiple cookie headers |
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.
Comma
tests/ServerTest.php
Outdated
$this->assertEquals(array(), $requestValidation->getCookieParams()); | ||
} | ||
|
||
public function testCookieWithSepeartorWillBeAddedToServerRequest() |
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.
MEthod name typo
M
04f89d2
to
0a4e5e1
Compare
{ | ||
// PSR-7 `getHeaderLine('Cookies')` will return multiple | ||
// cookie header comma-seperated. Multiple cookie headers | ||
// are not allowed according to https://tools.ietf.org/html/rfc6265#section-5.4 |
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.
Should imho read
... PSR-7 getHeaderLine('Cookie')
will return multiple comma-seperated cookie headers.
FYI Travis failure was unrelated to this PR and only on the HHVM job. |
This PR adds cookies to the PSR-7 ServerRequest. The implementation of cookies is line with the implementation of PHP.
I added a simple example to this to test this via a web browser.