Skip to content
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

Creates a ProxyAgent to forward all HTTP request to an HTTP proxy #569

Closed
mcollina opened this issue Feb 26, 2021 · 2 comments
Closed

Creates a ProxyAgent to forward all HTTP request to an HTTP proxy #569

mcollina opened this issue Feb 26, 2021 · 2 comments
Labels
good first issue Good for newcomers Status: help-wanted This issue/pr is open for contributions

Comments

@mcollina
Copy link
Member

mcollina commented Feb 26, 2021

Here is some example call

import { request, setGlobalAgent, ProxyAgent } from 'undici'

setGlobalDispatcher(new ProxyAgent('https://my.proxy.agent/'))

const {
  statusCode,
  headers,
  trailers,
  body
  // send the request via the https://my.proxy.agent/ HTTP proxy
} = await request('http://localhost:3000/foo')

console.log('response received', statusCode)
console.log('headers', headers)

for await (const data of body) {
  console.log('data', data)
}

console.log('trailers', trailers)

Follow up from #568

@mcollina mcollina added the good first issue Good for newcomers label Feb 26, 2021
@ronag ronag added the Status: help-wanted This issue/pr is open for contributions label Jun 30, 2021
@RafaelGSS
Copy link
Member

I'm working on it.

@RafaelGSS RafaelGSS mentioned this issue Oct 21, 2021
4 tasks
@RafaelGSS
Copy link
Member

It can be closed. #1070 was merged.

@ronag ronag closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Status: help-wanted This issue/pr is open for contributions
Projects
None yet
Development

No branches or pull requests

3 participants