{
  "type": "module",
  "source": "doc/api/api-envhttpproxyagent.md",
  "modules": [
    {
      "textRaw": "Class: EnvHttpProxyAgent",
      "name": "class:_envhttpproxyagent",
      "type": "module",
      "desc": "<p>Extends: <code>undici.Dispatcher</code></p>\n<p>EnvHttpProxyAgent automatically reads the proxy configuration from the environment variables <code>http_proxy</code>, <code>https_proxy</code>, and <code>no_proxy</code> and sets up the proxy agents accordingly. When <code>http_proxy</code> and <code>https_proxy</code> are set, <code>http_proxy</code> is used for HTTP requests and <code>https_proxy</code> is used for HTTPS requests. If only <code>http_proxy</code> is set, <code>http_proxy</code> is used for both HTTP and HTTPS requests. If only <code>https_proxy</code> is set, it is only used for HTTPS requests.</p>\n<p><code>no_proxy</code> is a comma or space-separated list of hostnames that should not be proxied. The list may contain leading wildcard characters (<code>*</code>). If <code>no_proxy</code> is set, the EnvHttpProxyAgent will bypass the proxy for requests to hosts that match the list. If <code>no_proxy</code> is set to <code>\"*\"</code>, the EnvHttpProxyAgent will bypass the proxy for all requests.</p>\n<p>Uppercase environment variables are also supported: <code>HTTP_PROXY</code>, <code>HTTPS_PROXY</code>, and <code>NO_PROXY</code>. However, if both the lowercase and uppercase environment variables are set, the uppercase environment variables will be ignored.</p>",
      "signatures": [
        {
          "textRaw": "`new EnvHttpProxyAgent([options])`",
          "name": "EnvHttpProxyAgent",
          "type": "ctor",
          "params": [
            {
              "name": "options",
              "optional": true
            }
          ],
          "desc": "<p>Arguments:</p>\n<ul>\n<li><strong>options</strong> <code>EnvHttpProxyAgentOptions</code> (optional) - extends the <code>Agent</code> options.</li>\n</ul>\n<p>Returns: <code>EnvHttpProxyAgent</code></p>",
          "modules": [
            {
              "textRaw": "Parameter: `EnvHttpProxyAgentOptions`",
              "name": "parameter:_`envhttpproxyagentoptions`",
              "type": "module",
              "desc": "<p>Extends: <a href=\"/docs/docs/api/Agent.html#parameter-agentoptions\"><code>AgentOptions</code></a></p>\n<ul>\n<li><strong>httpProxy</strong> <code>string</code> (optional) - When set, it will override the <code>HTTP_PROXY</code> environment variable.</li>\n<li><strong>httpsProxy</strong> <code>string</code> (optional) - When set, it will override the <code>HTTPS_PROXY</code> environment variable.</li>\n<li><strong>noProxy</strong> <code>string</code> (optional) - When set, it will override the <code>NO_PROXY</code> environment variable.</li>\n</ul>\n<p>Examples:</p>\n<pre><code class=\"language-js\">import { EnvHttpProxyAgent } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\n// or\nconst envHttpProxyAgent = new EnvHttpProxyAgent({ httpProxy: 'my.proxy.server:8080', httpsProxy: 'my.proxy.server:8443', noProxy: 'localhost' })\n</code></pre>",
              "modules": [
                {
                  "textRaw": "Example - EnvHttpProxyAgent instantiation",
                  "name": "example_-_envhttpproxyagent_instantiation",
                  "type": "module",
                  "desc": "<p>This will instantiate the EnvHttpProxyAgent. It will not do anything until registered as the agent to use with requests.</p>\n<pre><code class=\"language-js\">import { EnvHttpProxyAgent } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\n</code></pre>",
                  "displayName": "Example - EnvHttpProxyAgent instantiation"
                },
                {
                  "textRaw": "Example - Basic Proxy Fetch with global agent dispatcher",
                  "name": "example_-_basic_proxy_fetch_with_global_agent_dispatcher",
                  "type": "module",
                  "desc": "<pre><code class=\"language-js\">import { setGlobalDispatcher, fetch, EnvHttpProxyAgent } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\nsetGlobalDispatcher(envHttpProxyAgent)\n\nconst response = await fetch('http://localhost:3000/foo')\n\nconsole.log('response received', response.status) // response received 200\n\nconst data = await response.json() // data { foo: \"bar\" }\n</code></pre>",
                  "displayName": "Example - Basic Proxy Fetch with global agent dispatcher"
                },
                {
                  "textRaw": "Example - Basic Proxy Request with global agent dispatcher",
                  "name": "example_-_basic_proxy_request_with_global_agent_dispatcher",
                  "type": "module",
                  "desc": "<pre><code class=\"language-js\">import { setGlobalDispatcher, request, EnvHttpProxyAgent } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\nsetGlobalDispatcher(envHttpProxyAgent)\n\nconst { statusCode, body } = await request('http://localhost:3000/foo')\n\nconsole.log('response received', statusCode) // response received 200\n\nfor await (const data of body) {\n  console.log('data', data.toString('utf8')) // data foo\n}\n</code></pre>",
                  "displayName": "Example - Basic Proxy Request with global agent dispatcher"
                },
                {
                  "textRaw": "Example - Basic Proxy Request with local agent dispatcher",
                  "name": "example_-_basic_proxy_request_with_local_agent_dispatcher",
                  "type": "module",
                  "desc": "<pre><code class=\"language-js\">import { EnvHttpProxyAgent, request } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\n\nconst {\n  statusCode,\n  body\n} = await request('http://localhost:3000/foo', { dispatcher: envHttpProxyAgent })\n\nconsole.log('response received', statusCode) // response received 200\n\nfor await (const data of body) {\n  console.log('data', data.toString('utf8')) // data foo\n}\n</code></pre>",
                  "displayName": "Example - Basic Proxy Request with local agent dispatcher"
                },
                {
                  "textRaw": "Example - Basic Proxy Fetch with local agent dispatcher",
                  "name": "example_-_basic_proxy_fetch_with_local_agent_dispatcher",
                  "type": "module",
                  "desc": "<pre><code class=\"language-js\">import { EnvHttpProxyAgent, fetch } from 'undici'\n\nconst envHttpProxyAgent = new EnvHttpProxyAgent()\n\nconst response = await fetch('http://localhost:3000/foo', { dispatcher: envHttpProxyAgent })\n\nconsole.log('response received', response.status) // response received 200\n\nconst data = await response.json() // data { foo: \"bar\" }\n</code></pre>",
                  "displayName": "Example - Basic Proxy Fetch with local agent dispatcher"
                }
              ],
              "displayName": "Parameter: `EnvHttpProxyAgentOptions`"
            }
          ]
        }
      ],
      "modules": [
        {
          "textRaw": "Instance Methods",
          "name": "instance_methods",
          "type": "module",
          "methods": [
            {
              "textRaw": "`EnvHttpProxyAgent.close([callback])`",
              "name": "close",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherclosecallback-promise\"><code>Dispatcher.close([callback])</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.destroy([error, callback])`",
              "name": "destroy",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "error",
                      "optional": true
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdestroyerror-callback-promise\"><code>Dispatcher.destroy([error, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.dispatch(options, handler: AgentDispatchOptions)`",
              "name": "dispatch",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler: AgentDispatchOptions"
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdispatchoptions-handler\"><code>Dispatcher.dispatch(options, handler)</code></a>.</p>",
              "modules": [
                {
                  "textRaw": "Parameter: `AgentDispatchOptions`",
                  "name": "parameter:_`agentdispatchoptions`",
                  "type": "module",
                  "desc": "<p>Extends: <a href=\"/docs/docs/api/Dispatcher.html#parameter-dispatchoptions\"><code>DispatchOptions</code></a></p>\n<ul>\n<li><strong>origin</strong> <code>string | URL</code></li>\n</ul>\n<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdestroyerror-callback-promise\"><code>Dispatcher.destroy([error, callback])</code></a>.</p>",
                  "displayName": "Parameter: `AgentDispatchOptions`"
                }
              ]
            },
            {
              "textRaw": "`EnvHttpProxyAgent.connect(options[, callback])`",
              "name": "connect",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherconnectoptions-callback\"><code>Dispatcher.connect(options[, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.dispatch(options, handler)`",
              "name": "dispatch",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler"
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdispatchoptions-handler\"><code>Dispatcher.dispatch(options, handler)</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.pipeline(options, handler)`",
              "name": "pipeline",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler"
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherpipelineoptions-handler\"><code>Dispatcher.pipeline(options, handler)</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.request(options[, callback])`",
              "name": "request",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherrequestoptions-callback\"><code>Dispatcher.request(options [, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.stream(options, factory[, callback])`",
              "name": "stream",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "factory"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherstreamoptions-factory-callback\"><code>Dispatcher.stream(options, factory[, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`EnvHttpProxyAgent.upgrade(options[, callback])`",
              "name": "upgrade",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherupgradeoptions-callback\"><code>Dispatcher.upgrade(options[, callback])</code></a>.</p>"
            }
          ],
          "displayName": "Instance Methods"
        }
      ],
      "displayName": "Class: EnvHttpProxyAgent"
    }
  ]
}