{
  "type": "module",
  "source": "doc/api/api-fetch.md",
  "modules": [
    {
      "textRaw": "Fetch",
      "name": "fetch",
      "type": "module",
      "desc": "<p>Undici exposes a fetch() method starts the process of fetching a resource from the network.</p>\n<p>Documentation and examples can be found on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/fetch\">MDN</a>.</p>",
      "modules": [
        {
          "textRaw": "FormData",
          "name": "formdata",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/FormData\">MDN</a>.</p>\n<p>If any parameters are passed to the FormData constructor other than <code>undefined</code>, an error will be thrown. Other parameters are ignored.</p>\n<p>When you use <code>FormData</code> as a request body, keep <code>fetch</code> and <code>FormData</code> from the\nsame implementation. Use the built-in global <code>FormData</code> with the built-in\nglobal <code>fetch()</code>, and use <code>undici</code>'s <code>FormData</code> with <code>undici.fetch()</code>.</p>\n<p>If you want the installed <code>undici</code> package to provide the globals, call\n<a href=\"/docs/docs/api/GlobalInstallation.html\"><code>install()</code></a> so <code>fetch</code>, <code>Headers</code>,\n<code>Response</code>, <code>Request</code>, and <code>FormData</code> are installed together as a matching set.</p>",
          "displayName": "FormData"
        },
        {
          "textRaw": "Response",
          "name": "response",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Response\">MDN</a></p>",
          "displayName": "Response"
        },
        {
          "textRaw": "Request",
          "name": "request",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Request\">MDN</a></p>",
          "displayName": "Request"
        },
        {
          "textRaw": "Headers",
          "name": "headers",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Headers\">MDN</a></p>",
          "displayName": "Headers"
        },
        {
          "textRaw": "FormData",
          "name": "formdata",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/FormData\">MDN</a>.</p>\n<p>If any parameters are passed to the FormData constructor other than <code>undefined</code>, an error will be thrown. Other parameters are ignored.</p>\n<p>When you use <code>FormData</code> as a request body, keep <code>fetch</code> and <code>FormData</code> from the\nsame implementation. Use the built-in global <code>FormData</code> with the built-in\nglobal <code>fetch()</code>, and use <code>undici</code>'s <code>FormData</code> with <code>undici.fetch()</code>.</p>\n<p>If you want the installed <code>undici</code> package to provide the globals, call\n<a href=\"/docs/docs/api/GlobalInstallation.html\"><code>install()</code></a> so <code>fetch</code>, <code>Headers</code>,\n<code>Response</code>, <code>Request</code>, and <code>FormData</code> are installed together as a matching set.</p>",
          "displayName": "FormData"
        },
        {
          "textRaw": "Response",
          "name": "response",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Response\">MDN</a></p>",
          "displayName": "Response"
        },
        {
          "textRaw": "Request",
          "name": "request",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Request\">MDN</a></p>",
          "displayName": "Request"
        },
        {
          "textRaw": "Headers",
          "name": "headers",
          "type": "module",
          "desc": "<p>This API is implemented as per the standard, you can find documentation on <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/Headers\">MDN</a></p>",
          "displayName": "Headers"
        }
      ],
      "displayName": "Fetch"
    },
    {
      "textRaw": "Body Mixins",
      "name": "body_mixins",
      "type": "module",
      "desc": "<p><code>Response</code> and <code>Request</code> body inherit body mixin methods. These methods include:</p>\n<ul>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-arraybuffer\"><code>.arrayBuffer()</code></a></li>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-blob\"><code>.blob()</code></a></li>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-bytes\"><code>.bytes()</code></a></li>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-formdata\"><code>.formData()</code></a></li>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-json\"><code>.json()</code></a></li>\n<li><a href=\"https://fetch.spec.whatwg.org/#dom-body-text\"><code>.text()</code></a></li>\n</ul>\n<p>There is an ongoing discussion regarding <code>body.formData()</code> and its usefulness, performance, and security in server environments. Calling <code>body.formData()</code> causes undici to buffer and parse the entire body. Because multipart parsing has inherent security risks, <code>body.formData()</code> must only be called on responses from trusted servers.</p>\n<p>For responses from untrusted or user-controlled servers, use a dedicated streaming library for parsing <code>multipart/form-data</code> bodies, such as <a href=\"https://www.npmjs.com/package/busboy\">Busboy</a> or <a href=\"https://www.npmjs.com/package/@fastify/busboy\">@fastify/busboy</a>, and apply application-specific limits.</p>\n<p>These libraries can be interfaced with fetch with the following example code:</p>\n<pre><code class=\"language-mjs\">import { Busboy } from '@fastify/busboy'\nimport { Readable } from 'node:stream'\n\nconst response = await fetch('...')\nconst busboy = new Busboy({\n  headers: {\n    'content-type': response.headers.get('content-type')\n  }\n})\n\nReadable.fromWeb(response.body).pipe(busboy)\n</code></pre>",
      "displayName": "Body Mixins"
    }
  ]
}