forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove headers filtering (nodejs#1469)
* feat: remove headers filtering * add wintercg issue to README * update README * fix(Headers): properly use/set "this's headers" * fix: remove broken guard checks
- Loading branch information
Showing
7 changed files
with
78 additions
and
185 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
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
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,50 @@ | ||
'use strict' | ||
|
||
const { once } = require('events') | ||
const { createServer } = require('http') | ||
const { test } = require('tap') | ||
const { fetch, Headers } = require('../..') | ||
|
||
test('Can receive set-cookie headers from a server using fetch - issue #1262', async (t) => { | ||
const server = createServer((req, res) => { | ||
res.setHeader('set-cookie', 'name=value; Domain=example.com') | ||
res.end() | ||
}).listen(0) | ||
|
||
t.teardown(server.close.bind(server)) | ||
await once(server, 'listening') | ||
|
||
const response = await fetch(`http://localhost:${server.address().port}`) | ||
|
||
t.equal(response.headers.get('set-cookie'), 'name=value; Domain=example.com') | ||
|
||
const response2 = await fetch(`http://localhost:${server.address().port}`, { | ||
credentials: 'include' | ||
}) | ||
|
||
t.equal(response2.headers.get('set-cookie'), 'name=value; Domain=example.com') | ||
|
||
t.end() | ||
}) | ||
|
||
test('Can send cookies to a server with fetch - issue #1463', async (t) => { | ||
const server = createServer((req, res) => { | ||
t.equal(req.headers.cookie, 'value') | ||
res.end() | ||
}).listen(0) | ||
|
||
t.teardown(server.close.bind(server)) | ||
await once(server, 'listening') | ||
|
||
const headersInit = [ | ||
new Headers([['cookie', 'value']]), | ||
{ cookie: 'value' }, | ||
[['cookie', 'value']] | ||
] | ||
|
||
for (const headers of headersInit) { | ||
await fetch(`http://localhost:${server.address().port}`, { headers }) | ||
} | ||
|
||
t.end() | ||
}) |
Oops, something went wrong.