node
node copied to clipboard
Error if message is bigger than Content-Length
Pr for issue #39041
The test for the changes is very simple, it just contains a 200 request with a header specifying the "Content-Lenght", in this case with a size of 2 bytes, with a response of 4 so the error could be triggered.
tests:
- If we change the value of the Content-Lenght for the actual one or a bigger one, we have no error.
- Finally, we do a request with no headers just to prove that the code still running, even with the new #changes.
Unrelated documentation changes in doc/api/errors.md
. (Line 9 to Line 805 | Line 821 to Line 3241)
Hey @ronag for .end(), how many bytes would be a good amount so the error is not triggered? I was thinking that it should be at least half of the size of the Content-Length
Hey @ronag for .end(), how many bytes would be a good amount so the error is not triggered? I was thinking that it should be at least half of the size of the Content-Length
If it doesn’t match content length then error
@betochf Could you please rebase and resolve the merge conflicts?
@RaisinTen done, it was an error in the Doc
@ronag I did the changes... which other tests should I try?
I think 3 tests should be added at least:
- when actual length is mismatched (more or less) with
Content-Length
, it should throw; - when
Content-Length
is negative, it should throw;