%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/doc/node-undici/examples/
Upload File :
Create Path :
Current File : //usr/share/doc/node-undici/examples/proxy-agent.js

'use strict'

const { request, setGlobalDispatcher, ProxyAgent } = require('../')

setGlobalDispatcher(new ProxyAgent('http://localhost:8000/'))

async function main () {
  const {
    statusCode,
    headers,
    trailers,
    body
    // send the request via the http://localhost:8000/ HTTP proxy
  } = await request('http://localhost:3000/undici')

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

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

  console.log('trailers', trailers)
}
main()

Zerion Mini Shell 1.0