-
-
Notifications
You must be signed in to change notification settings - Fork 31
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 Content-Length for POST when data empty #78
base: 2.19.x
Are you sure you want to change the base?
Conversation
@@ -1256,6 +1256,11 @@ protected function prepareHeaders($body, $uri) | |||
$headers['Content-Length'] = strlen($body); | |||
} | |||
} | |||
else { | |||
if ($this->getMethod() == 'POST') { | |||
$headers['Content-Length'] = 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.
What about PUT
, PATCH
, etc.?
Also, this kind of change must be accompanied with a test.
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.
Hi,
I'm not a developer but I can try to improve this PR. Do you have a procedure to run phpunit test locally ?
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.
Hey,
You can do this locally, if you have php
and composer
installed:
git clone <this-repo>
composer install
./vendor/bin/phpunit
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 contributing guidelines can also be helpful.
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.
Hello,
I had a test.
For PUT, PATCH and others, I'm not sure what to do...
7c243d1
to
d0d8e23
Compare
6a8695e
to
167f4cd
Compare
Signed-off-by: Jacques ROUSSEL <[email protected]>
167f4cd
to
d16ce47
Compare
Description
The RFC7230 says :
Some load balancers reject empty POST without a Content-Lenght set to 0 with an HTTP 411 error. For instance Google Global Load Balancers does.