1

using chrome.webRequest I can modify request or response headers, however I also need modify Response.statusCode, is it possible? I do not see anything in documentation.

https://developer.chrome.com/docs/extensions/reference/webRequest/

I see something interesting here: https://tweak-extension.com/blog/how-to-override-http-status-code#lets-override

It seems the request is not sent but a mock response has been applied but I'm not sure how.

PeiSong
  • 871
  • 1
  • 7
  • 12
  • It depends on the type of requests. If it's a `fetch` or `XMLHttpRequest` you can override their prototypes in [page context](/a/9517879) and override the returned data any way you want. If it's a built-in request made by the browser the only way to override the status code is chrome.debugger API and [Fetch](https://chromedevtools.github.io/devtools-protocol/tot/Fetch) events+commands. – wOxxOm Jan 03 '23 at 15:26
  • @wOxxOm I think the debugger API is the way to go, thanks! – PeiSong Jan 03 '23 at 16:10

0 Answers0