-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Fix] Content-Length header on explicit null body response #1528
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 header on explicit null body response #1528
Conversation
Responding with an empty message, that does not have a Transfer-Encoding header field set, a Content-Length header field is used to provide the anticipated size for a potential payload body.The Content-Length header should be provided in such case(s), so that the user agent does not fail the request / response cycle. ✅ Closes: koajs#1525
Extend upon existing and provide new unit tests, for asserting the content-length header presence and value on the explicit null body responses. ✅ Closes: koajs#1525
Codecov Report
@@ Coverage Diff @@
## master #1528 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 489 490 +1
Branches 136 136
=========================================
+ Hits 489 490 +1
Continue to review full report at Codecov.
|
3imed-jaberi
left a comment
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.
lgtm +1
jkomyno
left a comment
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.
This commit seems legitimate.
But why is it necessary to test the absence of the 'transfer-encoding' header?
|
@jkomyno I apologize for getting back late. I've been offline for a week, due to the health issues. I've referenced the RFC7230.
Do you think the assertion should be removed? |
|
Any updates on the MR? |
|
@ognjenjevremovic I will merge it if I have time to do a release. hopefully someone else will get to it before I do |
Fixes #1525
Changes
Checklist
After the changes I ensured that:
npm run lintfrom the root directory,npm run testfrom the root directory,npm run buildfrom the root directory.Done