-
Notifications
You must be signed in to change notification settings - Fork 9
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
Sending Content-Length: 0 is optional for TRACE #33
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.
i'd rather not add fake data that whe then assert on, that feels strange.
src/HttpBaseTest.php
Outdated
@@ -270,6 +270,10 @@ protected function assertRequest( | |||
|
|||
$name = strtoupper(str_replace('-', '_', 'http-'.$name)); | |||
|
|||
if ($method === 'TRACE' && $name === 'HTTP_CONTENT_LENGTH' && !isset($request['SERVER'][$name])) { | |||
$request['SERVER'][$name] = '0'; |
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.
so we add a fake content length? while this works, i would prefer to simply log a $this->success() and return instead. the assertions below make no sense if we just set the value.
i agree that if content length is set, it must be correctly at 0.
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.
That makes everything more complicated. The test correctly asserts that there's a content-length: 0
or no header at all. While this specific assertion might be useless then, there are always non-useless assertions.
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.
but you could replace this line by return;
and the test would still do the same, right? i would find that more readable.
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.
No, but can replace it with continue;
, just did that.
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.
ups, did not read the context :-)
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.
looks good to me. thanks @kelunik !
All tests passes. Thank you! |
What's in this PR?
As no body is allowed, the
content-length
header is optional.