[whatwg/fetch] Add onInformation interim response support (PR #1942)

Adds an optional fetch call for receiving 1xx responses in a fetch.

e.g.

```js
fetch('...', {
  onInformation(status, headers) {
    // status is the 1xx code
    // headers is the Headers object
  },
});
```

Support is entirely optional. Implementations that currently would ignore `onInformation` are fully compliant.

---

- [ ] At least two implementers are interested (and none opposed):
   * …
   * …
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * … <!-- If these tests are tentative, link a PR to make them non-tentative. -->
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chromium: …
   * Gecko: …
   * WebKit: …
   * Deno (not for CORS changes): …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [ ] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use. <!-- If you created this PR from a single commit, Github copied its message. Otherwise, you need to add a commit message yourself. -->

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***

### :boom: Error: 422 Unprocessable Entity :boom: ###

[PR Preview](https://github.com/tobie/pr-preview#pr-preview) failed to build. _(Last tried on Jul 11, 2026, 7:14 PM UTC)_.

<details>
<summary>More</summary>


PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

:rotating_light: [Spec Generator](https://www.w3.org/publications/spec-generator/) - Spec Generator is the web service used to build bikeshed/ReSpec specs

:link: [Related URL](https://www.w3.org/publications/spec-generator/?type=bikeshed-spec&output=html&url=https%3A%2F%2Fraw.githubusercontent.com%2Fjasnell%2Ffetch%2Fcb1a25398495f44d0b45bee3b6c8398ede0d4c87%2Ffetch.bs&force=1&md-status=LS-PR&md-Text-Macro=PR-NUMBER%201942)

**Error output:**

```json
[
    {
        "lineNum": "9769:11",
        "messageType": "link",
        "text": "No 'dfn' refs found for 'invoke a callback function'."
    },
    {
        "lineNum": "6768:10",
        "messageType": "lint",
        "text": "RFC2119 keyword in non-normative section (use: might, can, has to, or override with <span class=allow-2119>): \n         callback is invoked for all informational responses, including 100 (Continue),\n         101 (Switching Protocols), 102 (Processing), and 103 (Early Hints).\n         Support for invoking this callback is entirely optional; implementations that\n         never invoke it are fully compliant with this specification.\n\n       "
    },
    {
        "lineNum": "8764:4",
        "messageType": "lint",
        "text": "RFC2119 keyword in non-normative section (use: might, can, has to, or override with <span class=allow-2119>):  object containing the informational\n   response’s headers, appropriately filtered. Any return value is ignored. Implementations are\n   not required to support informational responses and may ignore this option entirely.\n  "
    },
    {
        "lineNum": null,
        "messageType": "failure",
        "text": "Did not generate, due to errors exceeding the allowed error level."
    }
]
```

_This seems to be an issue with the [Spec Generator](https://www.w3.org/publications/spec-generator/) service. PR Preview doesn't manage this service and so has no control over it. If you've identified an issue with it, you can [report the issue to the maintainers of Spec Generator](https://github.com/w3c/spec-generator/issues/new) directly. Please be courteous. Thank you!_

_If you don't have enough information above to solve the error by yourself or if the issue doesn't seem related to Spec Generator, you can [file an issue with PR Preview](https://github.com/tobie/pr-preview/issues/new?title=Unidentified%20Error&body=See%20whatwg/fetch%231942.)._

</details>

You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/fetch/pull/1942

-- Commit Summary --

  * Add onInformation interim response support

-- File Changes --

    M fetch.bs (163)

-- Patch Links --

https://github.com/whatwg/fetch/pull/1942.patch
https://github.com/whatwg/fetch/pull/1942.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1942
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1942@github.com>

Received on Saturday, 11 July 2026 19:14:50 UTC