Skip to content

Commit 7afb00a

Browse files
committed
🔧 fix: plain native static response
1 parent 0eea839 commit 7afb00a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export type Context<
134134
redirect: Redirect
135135

136136
set: {
137-
headers: HTTPHeaders
137+
headers: HTTPHeaders
138138
status?: number | keyof StatusMap
139139
/**
140140
* @deprecated Use inline redirect instead

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ export type HTTPHeaders = Record<string, string> & {
14801480

14811481
// Message body information
14821482
'content-length'?: string
1483-
'content-type'?: SetContentType | {}
1483+
'content-type'?: SetContentType | (string & {})
14841484
'content-encoding'?: string
14851485
'content-language'?: string
14861486
'content-location'?: string

test/core/native-static.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe('Native Static Response', () => {
3939

4040
expect(app.router.static.http.static['/']).toBeInstanceOf(Response)
4141
expect(app.router.static.http.static['/'].headers.toJSON()).toEqual({
42+
'content-type': 'text/plain;charset=utf-8',
4243
server: 'Elysia'
4344
})
4445
expect(await app.router.static.http.static['/'].text()).toEqual(
@@ -51,6 +52,7 @@ describe('Native Static Response', () => {
5152
expect(
5253
app.router.static.http.static['/plugin'].headers.toJSON()
5354
).toEqual({
55+
'content-type': 'text/plain;charset=utf-8',
5456
server: 'Elysia'
5557
})
5658
expect(await app.router.static.http.static['/plugin'].text()).toEqual(

0 commit comments

Comments
 (0)