-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
node/http.ts
http.request
should support socketPath
option
#17910
Comments
npm:[email protected]
got type errornpm:[email protected]
got type error
minimal reproducevoid http.request(
'http://localhost/version',
{
socketPath: '/var/run/docker.sock',
},
(res) => res.on('data', (c) => console.log('' + c)),
).end() Expected$ node
> void http.request('http://localhost/version', {socketPath: '/var/run/docker.sock'}, (res)=>res.on('data',c=>console.log(''+c))).end()
// {"Platform": ... Actual$ deno
> import http from 'node:http'
> void http.request('http://localhost/version', {socketPath: '/var/run/docker.sock'}, (res)=>res.on('data',c=>console.log(''+c))).end()
// nothing
|
npm:[email protected]
got type errornode/http.ts
http.request
should support socketPath
option
https://deno.land/x/[email protected]/mod.ts Maybe can merge that library into |
Unfortunately my socket_fetch library is incomplete :( It can only perform GET requests and is not optimized. I use it to query specific things but it's not in a shape to be dropped into npm libraries I think. Ideally Deno ships some sort of Unix socket fetch client instead :) |
Workaround import { fetch, Agent } from 'undici'
const resp = await fetch('http://localhost/version', {
dispatcher: new Agent({
connect: {
socketPath: '/var/run/docker.sock'
}
})
})
console.log(await resp.text()) $ deno run --unstable -A ./reproduce.mjs
{"Platform":... |
Related [feat] Make backend js ecosystem future better |
Describe the bug
Steps to Reproduce
Expected behavior
Environment
The text was updated successfully, but these errors were encountered: