Custom response middleware without `body-parser`
See original GitHub issueAs first discussed here, in version 1.3.5
there is a breaking change (commit) that affects custom response middleware.
body-parser
was added before the custom middleware, which means that the request is consumed before it can reach the custom code. This means that the ‘data’ and ‘end’ request events are no longer called in the custom code. See this issue for a better explanation.
Maybe revert to the old code (let the response unaltered) and add a config option to enable parsing the JSON body for you?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Parsing JSON in Express without BodyParser - Stack Overflow
I think the problem like to get rawBody in express. Just like this: app.use(function(req, res, next){ var data = ""; req.on('data', ...
Read more >Express body-parser middleware
Node.js body parsing middleware. Parse incoming request bodies in a middleware before your handlers, available under the req.body property. Note As ...
Read more >Express JS— body-parser and why may not need it - Medium
This piece of middleware was called body-parser and used to not be part of the Express framework. The good news is that as...
Read more >Use body-parser Express Middleware to Parse JSON and ...
We can parse JSON bodies by calling the JSON method. It takes an optional object with a few properties. The options include: ......
Read more >Middleware and Helpers - Gatsby
Data formats; Response helpers; Custom middleware; Custom body parsing ... This object allows you to control the body-parser middleware used by Gatsby ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for taking care of it. Since
body-parser
is a default tool used to parse body, I’ve added a small PR to unlock its more detailed configurationYes, you are right. I’ll try to check if it’s easy to do. And if so, I’ll do the fix today.