-
Notifications
You must be signed in to change notification settings - Fork 872
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How can I print out request bodies #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
mount your |
Thanks for the suggestion. I did try this. I get a working proxy, but get 'undefined' for req.body (probably because then bodyParsers are now after my app.use() that dumps the data.) If I put apiProxy before my app.use(), my app.use() never gets called. |
Update - I had success using the npm 'body' package rather 'body-parser'. |
@garyns work for me |
@garyns can you tell the sample how it worked for you. When I am using npm body still my socket is hanging. |
can you please show an example of how to use body ? |
Hi @chimurai Would you mind adding the "mount your apiProxy before mounting the bodyParser middlewares" nugget to the README file? I just spent three days trying to figure out why my proxy was hanging, until I stumbled upon this issue. Thanks, |
|
Found that it is possible to do it with the bodyParser middleware by following this example which shows the need to re-stream the body in the |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi, I'm trying to create a small development proxy to print out to the console headers, query params, and body.
But I can't get the body and prioxy to work together, and all my research had not given me any obvious solution.
In the code below, when I enable bodyParsers, I get the body printed to the console, but any PUT or POST request that contains a body ends up hanging. With no bodyParsers, req.body is undefined (as pre express docs) and the proxied request completes successfully.
Any advise on how I might approach this?
Thanks in advance.
The text was updated successfully, but these errors were encountered: