juspay / juspay/purescript-body-parser
Move response handling out of body-parser
Open
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
As of now, both the `xml` and `multipart` parsers are setting response codes and serving requests in case of a parse error. We should ideally let the end-user handle these errors in their app. We can do this by calling `next` with a parse error.
e.g.
``` javascript
// ... inside parser function
try {
// try to parse
// add parsed data to request body
req.body = parsedReq
next()
} catch (e) {
// do either of the following
next(e)
// or
next(new Error(''))
}
// ...
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.