Skip to content

Commit e9f5ea1

Browse files
authored
Set default content type for TextResponse (#52)
2 parents 8c557cb + 8fc5603 commit e9f5ea1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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)