Skip to content

Commit 8c557cb

Browse files
authored
EmptyResponse set content-lengt: 0 unless header already set (#58)
2 parents 9e18a7d + 0fee76f commit 8c557cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/response/EmptyResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export class EmptyResponse<A> extends Response<A> {
1616
}
1717

1818
protected override async send(res: http.ServerResponse, req?: Request<A>): Promise<void> {
19-
if (req !== undefined)
20-
req._responseHeaders.set("content-length", "0");
19+
if (!this.headers.has("content-length"))
20+
this.headers.set("content-length", "0");
2121
this.writeHead(res, req);
2222
res.end();
2323
}

0 commit comments

Comments
 (0)