-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update tests to check for no-op
- Loading branch information
1 parent
1f2f493
commit 29db476
Showing
2 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const { createServer, request } = require('http'); | ||
|
||
const server = createServer( | ||
common.mustCall((req, res) => { | ||
req.headersDistinct = { 'x-req-a': ['zzz'] }; | ||
|
||
// headersDistinct setter should be a No-Op | ||
assert.deepStrictEqual(req.headersDistinct, { | ||
'transfer-encoding': [ | ||
'chunked', | ||
], | ||
'connection': [ | ||
'keep-alive', | ||
], | ||
'host': [ | ||
`127.0.0.1:${server.address().port}`, | ||
] | ||
}); | ||
|
||
req.on('end', function() { | ||
res.write('BODY'); | ||
res.end(); | ||
}); | ||
|
||
req.resume(); | ||
}) | ||
); | ||
|
||
server.listen( | ||
0, | ||
common.mustCall(() => { | ||
const req = request( | ||
{ | ||
host: '127.0.0.1', | ||
port: server.address().port, | ||
path: '/', | ||
method: 'POST', | ||
}, | ||
common.mustCall((res) => { | ||
res.on('end', function() { | ||
server.close(); | ||
}); | ||
res.resume(); | ||
}) | ||
); | ||
|
||
req.write('BODY'); | ||
req.end(); | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters