Returning a native fetch()
-response throws TypeError: immutable
#10366
Labels
bug
Something isn't working
fetch()
-response throws TypeError: immutable
#10366
Describe the bug
According to the
fetch()
-specification, a header can have animmutable
-guard which will throw aTypeError
if the header is changed: https://fetch.spec.whatwg.org/#headers-classWhen using
fetch()
, the spec requires the response header to beimmutable
(see step 12/4):https://fetch.spec.whatwg.org/#fetch-method
This is implemented in undici (used by Node.js for native fetch() under the hood):
https://github.com/nodejs/undici/blob/22bdbd8c7820035276b4e876daccef513c29f5c4/lib/fetch/headers.js#L234-L239
The change introduced in #9993 will try to mutate the response header in certain scenarios, thus causing a
TypeError
.Reproduction
A reproduction via failing test-case can be found in PR #10367.
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
This bug was caused by #9993.
The text was updated successfully, but these errors were encountered: