How to get response object in reject middleware?
See original GitHub issueOur server returns statuses like 400 with some json explaining what happens. Is there any way, how to get response object in rejectMiddleware to get these data and respond to them globally?
trae.after(null, (err) => {
// Give me the response here :(
});
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Create a middleware to verify a response object before ...
I want to have a middleware that takes all my responses and verifies them against the expected object schemas. The issue what I'm...
Read more >Reject (FAIL) action based on response · Issue #71 - GitHub
Reject (FAIL) action based on response #71 ... With redux-axios-middleware I can get the action to fail with returnRejectedPromiseOnError ...
Read more >Writing middleware for use in Express apps
Middleware functions can perform the following tasks: Execute any code. Make changes to the request and the response objects. End the request-response cycle....
Read more >Using Express.js Routes for Promise-based Error Handling
Express.js middleware functions are functions that have access to the request object (typically "req"), the response object ("res"), and the next middleware ......
Read more >A Guide to Error Handling in Express.js | Scout APM Blog
Express Middleware Functions; Default Error Handling in Express.js ... They have access to the request and the response objects.
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 Free
Top 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
@gillchristian Sorry. By “raw response” I mean same as for success ofc 😃
For me it makes sense to add response to Error object. It feels natural to me and it is something what I always look for when using some library.
Other features like customizing valid status sounds great too. It can give you more precise controling, but on other hand I am not sure, how much complex and customizable should trae be. I would recommend to discuss it separately in other issue.
Closing since #60 was merged.