Workers response.arrayBuffer() fails in editor


I am currently experimenting with workers.

What I want to do is to fetch a remote url, change the headers, and return it. Since headers of responses are immutable, I have to read the body of the response and create a new response. Since the response is not regular text I use the following method to fetch the content:

await originalResponse.arrayBuffer();

When I try to test a URL in the workers editor I receive: Uncaught (in promise) Error: internal error. When I visit the same url via the browser, it works. This seems quite unexpected to me. Has anyone else seen this or an idea what might happen?


Can you share a full example?

I don’t think you have to read the body of the response just to change headers. You should be able to do something like:

let originalResponse = await fetch('....')

return new Response(originalResponse.body, {
  status: originalResponse.status,
  statusText: originalResponse.statusText,
  headers: {} // your headers


Thanks for the quick reply @martin2. I think there was a local caching issue, now it seems to work.

Regarding your proposed solution to change the header, this indeed works better than parsing the body, thank you for sharing the idea.