Document mutable headers on Response.json() - #45665
Closed
deerred643-star wants to merge 1 commit into
Closed
deerred643-star wants to merge 1 commit into
deerred643-star wants to merge 1 commit into
Conversation
deerred643-star
requested review from
sideshowbarker
and removed request for
a team
September 13, 2026 01:21
sideshowbarker
removed their request for review
September 14, 2026 12:34
Collaborator
|
I think this PR over-emphasises the mutable thing. Header mutability is already documented in https://developer.mozilla.org/en-US/docs/Web/API/Headers#modification_restrictions, so I don't really think it is needed here, and if it were needed, it should be done consistently across all the places that can give you a But even then, this PR makes it seem as if header mutability is the main point of the API, by for instance describing the return value as "A {{domxref("Response")}} object whose {{domxref("Response.headers", "headers")}} are mutable.". But that's really a detail about the API AFAICS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Document that the headers on a response created by
Response.json()are mutable, contrast them with the immutable headers on a fetched response, and demonstrate changing a header.Motivation
Readers currently have no indication that they can modify the headers after creating a JSON response.
Additional details
The Fetch Standard creates the response with a
responseheaders guard. The proposed change forResponse.redirect()is still pending in whatwg/fetch#1944, so this PR intentionally documents only the behavior that is already specified.Related issues and pull requests
Relates to mdn/mdn#858.