Response Data is Showing as Buffer #893
Unanswered
timchang87
asked this question in
Q&A
Replies: 1 comment
-
Might be the compression. Did you try the https://github.com/chimurai/http-proxy-middleware/blob/v2.0.6/recipes/response-interceptor.md |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am currently working on a proxy server that can capture request and response details. I am using another project that I've completed to test this. The proxy server should log the request url, http method of the request, response status code, processing time (total round trip time of the request/response cycle), and any data sent with the response. In this project, I am using webpack dev server, and proxying the traffic to my proxy server.
I am able to capture the url, method, status code, and processing time. However, the expected data from the response is intermittently logged. Most of the time, the response data is logged as
<Buffer >
(see below for examples). In the example below, you'll see 4 GET requests. The last 2 are requests to the /api/v1/auth/logout endpoint. However, the first has logged the expected response body. The latter, produces a response body of<Buffer >
. They should both be logging {"message":"Logged out"}.I have tested this against other projects that I have and I get the same result. I have also console logged the data event listener. When the response body logs
<Buffer >
, I've noticed that the data event listener on proxyRes, never fires. It's like the data event is never emitted.Any idea what could be causing this?
proxy.js
webpack config
Console Log
Beta Was this translation helpful? Give feedback.
All reactions