[Fix] Content-Length header on explicit null body response#1528
[Fix] Content-Length header on explicit null body response#1528ognjenjevremovic wants to merge 2 commits intokoajs:masterfrom
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.
|
jkomyno
left a comment
There was a problem hiding this comment.
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