Skip to content

Commit 875cc71

Browse files
authored
Merge branch 'main' into 9-add-stream-response
2 parents a1d0044 + e9f5ea1 commit 875cc71

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-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
}

src/response/TextResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export class TextResponse<A> extends BufferResponse<A> {
1919
public constructor(text: string, statusCode = 200, headers?: HeadersInit) {
2020
super(statusCode, headers);
2121
this.text = text;
22+
if (!this.headers.has("content-type"))
23+
this.headers.set("content-type", "text/plain");
2224
}
2325

2426
public override readBuffer() {

0 commit comments

Comments
 (0)