Skip to content

Commit a376217

Browse files
committed
fix: useGZipCompression was using deflate
1 parent a80da7a commit a376217

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/compression.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import type { H3Event } from 'h3'
2-
import type { RenderResponse } from './helper'
3-
import { compress, getAnyCompression } from './helper'
4-
5-
export async function useGZipCompression(
6-
event: H3Event,
7-
response: Partial<RenderResponse>,
8-
) {
9-
await compress(event, response, 'deflate')
10-
}
11-
12-
export async function useDeflateCompression(
13-
event: H3Event,
14-
response: Partial<RenderResponse>,
15-
) {
16-
await compress(event, response, 'deflate')
17-
}
18-
19-
export async function useBrotliCompression(
20-
event: H3Event,
21-
response: Partial<RenderResponse>,
22-
) {
23-
await compress(event, response, 'br')
24-
}
25-
26-
export async function useCompression(
27-
event: H3Event,
28-
response: Partial<RenderResponse>,
29-
) {
30-
const compression = getAnyCompression(event)
31-
if (compression)
32-
await compress(event, response, compression)
33-
}
1+
import type { H3Event } from 'h3'
2+
import type { RenderResponse } from './helper'
3+
import { compress, getAnyCompression } from './helper'
4+
5+
export async function useGZipCompression(
6+
event: H3Event,
7+
response: Partial<RenderResponse>,
8+
) {
9+
await compress(event, response, 'gzip')
10+
}
11+
12+
export async function useDeflateCompression(
13+
event: H3Event,
14+
response: Partial<RenderResponse>,
15+
) {
16+
await compress(event, response, 'deflate')
17+
}
18+
19+
export async function useBrotliCompression(
20+
event: H3Event,
21+
response: Partial<RenderResponse>,
22+
) {
23+
await compress(event, response, 'br')
24+
}
25+
26+
export async function useCompression(
27+
event: H3Event,
28+
response: Partial<RenderResponse>,
29+
) {
30+
const compression = getAnyCompression(event)
31+
if (compression)
32+
await compress(event, response, compression)
33+
}

0 commit comments

Comments
 (0)