Is it possible to read the proxy's response?
I recently built a small webserver that basically uses node-http-proxy to help me for development purposes.
I wanted to cache the RESTful API's response as a plaintext file to edit it and serve the edited content, if it exists.
However, in order to do this, I had to get pass gzip content. I ended up making another GET request to the API, unzipped the response and saved it to a file, here.
I've read the entry on modifying the proxy's response, however this is not what I want, because I want this to work for JSON, too (which is problematic for trumpet - which uses css selectors) and I don't want to make any modifications on-the-fly with server-side logic.
Is there an easy way to avoid the second request to my API?
@DictumMortuum Hi, you can try this node-http-proxy-json
@langjt is it possible to read proxy's response if the response is in chunked, gzipped and eventually the buffer will be html.
@ravitadi If you need to deal with html, you can try harmon. If you only deal with json, you can try node-http-proxy-json
@langjt As @DictumMortuum said he don't need to modify response. So node-http-proxy-json is overkill and small bottleneck because it gunziping and gziping response.
He only needs get original response (raw JSON, not gzip) and save it to file.