Skip to content

Commit d13ffb5

Browse files
committed
Revert "fix: get set-cookie w/ credentials: include (nodejs#1454)"
This reverts commit 5a580ed.
1 parent 5a580ed commit d13ffb5

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

lib/fetch/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ async function mainFetch (fetchParams, recursive = false) {
654654
// Set response to the following filtered response with response as its
655655
// internal response, depending on request’s response tainting:
656656
if (request.responseTainting === 'basic') {
657-
response = filterResponse(response, 'basic', request.credentials)
657+
response = filterResponse(response, 'basic')
658658
} else if (request.responseTainting === 'cors') {
659659
response = filterResponse(response, 'cors')
660660
} else if (request.responseTainting === 'opaque') {

lib/fetch/response.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ function makeFilteredHeadersList (headersList, filter) {
407407
}
408408

409409
// https://fetch.spec.whatwg.org/#concept-filtered-response
410-
function filterResponse (response, type, credentials) {
410+
function filterResponse (response, type) {
411411
// Set response to the following filtered response with response as its
412412
// internal response, depending on request’s response tainting:
413413
if (type === 'basic') {
@@ -419,7 +419,7 @@ function filterResponse (response, type, credentials) {
419419
type: 'basic',
420420
headersList: makeFilteredHeadersList(
421421
response.headersList,
422-
(name) => credentials === 'include' || !forbiddenResponseHeaderNames.includes(name.toLowerCase())
422+
(name) => !forbiddenResponseHeaderNames.includes(name.toLowerCase())
423423
)
424424
})
425425
} else if (type === 'cors') {

test/fetch/client-fetch.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -403,21 +403,3 @@ test('custom agent node fetch', (t) => {
403403
t.strictSame(obj, await body.json())
404404
})
405405
})
406-
407-
test('get set-cookie with credentials: include (#1262)', (t) => {
408-
t.plan(1)
409-
410-
const server = createServer((req, res) => {
411-
res.setHeader('set-cookie', 'hello=world')
412-
res.end('Hello World!')
413-
})
414-
t.teardown(server.close.bind(server))
415-
416-
server.listen(0, async () => {
417-
const { headers } = await fetch(`http://localhost:${server.address().port}`, {
418-
credentials: 'include'
419-
})
420-
421-
t.equal(headers.get('set-cookie'), 'hello=world')
422-
})
423-
})

0 commit comments

Comments
 (0)