-
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.
http: headers(Distinct), trailers(Distinct) setters to be no-op
PR-URL: #45176 Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
ba89cea
commit 1a04881
Showing
3 changed files
with
63 additions
and
18 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
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