Skip to content

Commit 4a5f7d2

Browse files
committed
remove one redundant test, avoid brotli
1 parent 9d548bc commit 4a5f7d2

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

test/fetch/encoding.js

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const { closeServerAsPromise } = require('../utils/node-http')
1111
test('content-encoding header', async (t) => {
1212
const { strictEqual } = tspl(t, { plan: 2 })
1313

14-
const contentEncoding = 'gzip, br'
14+
const contentEncoding = 'deflate, gzip'
1515
const text = 'Hello, World!'
16-
const gzipBrotliText = Buffer.from('CxCAH4sIAAAAAAAAA/NIzcnJ11EIzy/KSVEEANDDSuwNAAAAAw==', 'base64')
16+
const gzipDeflateText = Buffer.from('H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA', 'base64')
1717

1818
const server = createServer({ joinDuplicateHeaders: true }, (req, res) => {
1919
res.writeHead(200,
@@ -22,26 +22,26 @@ test('content-encoding header', async (t) => {
2222
'Content-Type': 'text/plain'
2323
}
2424
)
25-
.end(gzipBrotliText)
25+
.end(gzipDeflateText)
2626
})
2727
t.after(closeServerAsPromise(server))
2828

2929
await once(server.listen(0), 'listening')
3030

3131
const response = await fetch(`http://localhost:${server.address().port}`)
3232

33-
strictEqual(await response.text(), text)
3433
strictEqual(response.headers.get('content-encoding'), contentEncoding)
34+
strictEqual(await response.text(), text)
3535

3636
await t.completed
3737
})
3838

3939
test('content-encoding header is case-iNsENsITIve', async (t) => {
4040
const { strictEqual } = tspl(t, { plan: 2 })
4141

42-
const contentEncoding = 'GZiP, bR'
42+
const contentEncoding = 'DeFlAtE, GzIp'
4343
const text = 'Hello, World!'
44-
const gzipBrotliText = Buffer.from('CxCAH4sIAAAAAAAAA/NIzcnJ11EIzy/KSVEEANDDSuwNAAAAAw==', 'base64')
44+
const gzipDeflateText = Buffer.from('H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA', 'base64')
4545

4646
const server = createServer({ joinDuplicateHeaders: true }, (req, res) => {
4747
res.writeHead(200,
@@ -50,32 +50,6 @@ test('content-encoding header is case-iNsENsITIve', async (t) => {
5050
'Content-Type': 'text/plain'
5151
}
5252
)
53-
.end(gzipBrotliText)
54-
})
55-
t.after(closeServerAsPromise(server))
56-
57-
await once(server.listen(0), 'listening')
58-
59-
const response = await fetch(`http://localhost:${server.address().port}`)
60-
61-
strictEqual(await response.text(), text)
62-
strictEqual(response.headers.get('content-encoding'), contentEncoding)
63-
64-
await t.completed
65-
})
66-
67-
test('response decompression according to content-encoding should be handled in a correct order', async (t) => {
68-
const { strictEqual } = tspl(t, { plan: 1 })
69-
70-
const contentEncoding = 'deflate, gzip'
71-
const text = 'Hello, World!'
72-
const gzipDeflateText = Buffer.from('H4sIAAAAAAAAA6uY89nj7MmT1wM5zuuf8gxkYZCfx5IFACQ8u/wVAAAA', 'base64')
73-
74-
const server = createServer({ joinDuplicateHeaders: true }, (req, res) => {
75-
res.writeHead(200, {
76-
'Content-Encoding': contentEncoding,
77-
'Content-Type': 'text/plain'
78-
})
7953
.end(gzipDeflateText)
8054
})
8155
t.after(closeServerAsPromise(server))
@@ -84,6 +58,7 @@ test('response decompression according to content-encoding should be handled in
8458

8559
const response = await fetch(`http://localhost:${server.address().port}`)
8660

61+
strictEqual(response.headers.get('content-encoding'), contentEncoding)
8762
strictEqual(await response.text(), text)
8863

8964
await t.completed

0 commit comments

Comments
 (0)