Comments (3)
I also ran into this. It turned out gzip was the culprit for me.
I added this:
decorateRequest: function ( req ) {
req.headers[ 'Accept-Encoding' ] = 'utf8';
return req;
}
and data.toString( 'utf8' )
stopped giving me jumbled poo-poo
from express-http-proxy.
Hi Tophe,
As the first problem, I tried it, you should try res.text in test case. It works, I comments on your commit.
For api.github.com, it's very wired, I thought there might be a https relative problem, but I tried https://httpbin.org, everything works fine. I doubt it's somehow relative to how the code to decode the buffer. I'll keep it in the issues list to when I can finally take time to figure it out.
PS: in the final response, resp.body contains the correct json object =.=
from express-http-proxy.
Not sure if this is related: I faced a similar issue where I couldn't access any data from the response in the intercept hook (also when proxying to Github), yet I saw the response in the browser. It turned out to be a caching-related issue.
I added this to solve the problem.
decorateRequest: function(req) {
delete req.headers['if-modified-since'];
delete req.headers['if-none-match'];
return req;
}
from express-http-proxy.
Related Issues (20)
- Do not terminate request after proxy response. Add option to pass proxyResponse to next middleware HOT 4
- memoizeHost option not working
- Can't update path with proxyReqPathResolver HOT 2
- Make the user request available in proxyErrorHandler
- proxyReqBodyDecorator value is not returned if parseReqBody == false
- DNS_PROBE_FINISHED_NXDOMAIN HOT 1
- ERR_HTTP_HEADERS_SENT when setting parseReqBody=true HOT 1
- form-urlencoded requests do not proxy correctly if content-type contains a semi-colon HOT 2
- Is this project still alive? Any alternatives? HOT 3
- "range" header is copied from container options even though it should be transitory
- Can I prevent express-http-proxy from unescaping string characters? HOT 1
- HTTP proxy HOT 2
- Can't use `proxy()` twice in an Express middleware stack HOT 11
- proxyReqOptDecorator not setting headers as described HOT 1
- How to use
- Major usability issue without `decorateRequest` HOT 1
- Tracking the response time HOT 1
- DeprecationWarning: OutgoingMessage.prototype._headers is deprecated *again* HOT 1
- SNI does not get set in outgoing connections
- Unable to change 'content-type' header of request HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-http-proxy.