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
I wrote a undici test. It fails with undici v5.11.0(as in node@18.12.1) and it works with undici v5.12.0 and above. So it will hopefully be fixed with the next nodejs release ;)
$ ./node_modules/.bin/tap test/single.js
test/single.js
const{ fetch }=require('..')const{ test }=require('tap')constnet=require('net')test('succeeds on early server socket close',(t)=>{t.plan(1)constserver=net.createServer((socket)=>{constmsg="HTTP/1.1 200 OK\r\ncontent-Type: application/json\r\nCache-Control: no-cache\r\nConnection: close\r\n\r\n[1,2,3]"socket.end(msg)})t.teardown(server.close.bind(server))server.listen(0,async()=>{constres=awaitfetch(`http://localhost:${server.address().port}`)try{constdata=awaitres.text()// internal fetch breaks heret.equal(data.toString(),"[1,2,3]")}catch(err){t.error(err)}})})
Version
v18.12.1
Platform
Linux xxx 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
Subsystem
node:internal/deps/undici/undici:11000:53
What steps will reproduce the bug?
I do have some devices with commercial embedded web servers. I am not able to query them using the new fetch API.
They work fine with curl, web browsers and the 'old' node-fetch package.
The following example is self contained and tries to simulate such an device and triggers the same internal error.
If you uncomment the first line the code uses the node-fetch implementation and works fine.
How often does it reproduce? Is there a required condition?
every time
What is the expected behavior?
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: