You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thank you for maintaining this library ❤️
Bug Description
I encountered an unexpected behaviour when using fetch with multi value headers via MockAgent.
I would expect the behaviour from fetch to be the same when using request(reference test) with MockAgent.
Is this behaviour expected and I am just missing something?
Reproducible By
save the following content as test/repro.js in the undici repository and then run npx tap test/repro.js
'use strict'const{ test }=require('tap')const{ setGlobalDispatcher, MockAgent }=require('..')const{ fetch }=require('..')test("MockAgent - headers should be array of strings (fetch)",async(t)=>{constmockAgent=newMockAgent();mockAgent.disableNetConnect();setGlobalDispatcher(mockAgent);constmockPool=mockAgent.get("http://localhost:3000");mockPool.intercept({path: "/foo",method: "GET",}).reply(200,"foo",{headers: {"set-cookie": ["foo=bar","bar=baz","baz=qux"],},});const{ headers }=awaitfetch("http://localhost:3000/foo",{method: "GET",});t.equal(headers.getSetCookie(),["foo=bar","bar=baz","baz=qux"]);});
Expected Behavior
headers.getSetCookie() should return an array (["foo=bar", "bar=baz", "baz=qux"]) but instead it just returns ["foo=bar,bar=baz,baz=qux"] (array with one entry and all values concatenated)
Logs & Screenshots
FAIL test/repro.js
✖ should be equal
test/repro.js
27 | });
28 |
> 29 | t.equal(headers.getSetCookie(), ["foo=bar", "bar=baz", "baz=qux"]);
| ----^
30 | });
--- expected
+++ actual
@@ -1,5 +1,3 @@
Array [
- "foo=bar",
- "bar=baz",
- "baz=qux",
+ "foo=bar,bar=baz,baz=qux",
]
test: test/repro.js MockAgent - headers should be array of strings (fetch)
Environment
Node v20.11.0
ubuntu-22.04
Additional context
The text was updated successfully, but these errors were encountered:
First of all thank you for maintaining this library ❤️
Bug Description
I encountered an unexpected behaviour when using
fetch
with multi value headers viaMockAgent
.I would expect the behaviour from
fetch
to be the same when usingrequest
(reference test) withMockAgent
.Is this behaviour expected and I am just missing something?
Reproducible By
save the following content as
test/repro.js
in the undici repository and then runnpx tap test/repro.js
Expected Behavior
headers.getSetCookie()
should return an array (["foo=bar", "bar=baz", "baz=qux"]
) but instead it just returns["foo=bar,bar=baz,baz=qux"]
(array with one entry and all values concatenated)Logs & Screenshots
Environment
Node v20.11.0
ubuntu-22.04
Additional context
The text was updated successfully, but these errors were encountered: