Skip to content

Commit 2df0dd8

Browse files
committed
fix: Add default content-type if not specified
1 parent 3a2a7e1 commit 2df0dd8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/response.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ function newResponse(this: Response, body: BodyInit | null, init?: ResponseInit)
3737
;(this as any).__body = body
3838
;(this as any).__init = init
3939
if (typeof body === 'string' || body instanceof ReadableStream) {
40-
;(this as any).__cache = [body, (init?.headers || {}) as Record<string, string>]
40+
;(this as any).__cache = [
41+
body,
42+
(init?.headers || { 'content-type': 'text/plain;charset=UTF-8' }) as Record<string, string>,
43+
]
4144
}
4245
}
4346
newResponse.prototype = responsePrototype

0 commit comments

Comments
 (0)