node:http
incorrectly send Transfer-Encoding: chunked
even if no body is written
#20063
Labels
node:http
incorrectly send Transfer-Encoding: chunked
even if no body is written
#20063
Original issue: #20033.
After debugging for a while, I found out that the HTTP
PUT
request was sent withTransfer-Encoding: chunked
header, although the body is empty.Which is different from Nodejs behavior:
The header is only added by the first calling request.write(chunk):
These are the headers Nodejs would send (
PUT
with no body):And these are the headers by Deno:
I tried digging into Deno source code to investigate the issue, and found that currently all
POST
,PATCH
andPUT
requests will be considered to have body:I don't know how to change the code to fix the issue yet. But I think of 2 ways:
hasBody
andhasContentTypeHeader
flags then check them inrequest.write
function to addTransfer-Encoding: chunked
(but I don't know whether thereqwest
crate supports adding header after started).reqwest
after the first call torequest.write
.I'd appreciate any help to implement this.
The text was updated successfully, but these errors were encountered: