> In a chrome extension, i need to modify a particular http response > before it is actually handled by the browser. > > If the real response is valid (with 200 as status), i need to modify > the body. From my readings, i should be able to achieve so by > changing the "content-type" header from an http-on-examine-response > listener to something specific on which i registered a stream > converter. > > If the response is not valid (e.g status 404), i would like to fake a > successful (status 200) response and provide my own response body. > However, the nsIHttpChannel provides a setResponseHeader for changing > a particular header, but nothing for changing the HTTP response > status: the field 'responseStatus' is readonly. > > How should i proceed ? Is it at all possible ?
What if i replace the component @mozilla.org/network/protocol;1? name=http with my own protocol handler that basically forwards all API methods to the original http handler. I should be able to intercept requests i'm interested in (presumably within the newChannel method) and return a channel of my own that i can control at will. Would this method work implemented in javascript ? Thanks, Marie. _______________________________________________ dev-tech-network mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-network
