core: Latest type-is release breaks body-parser
So the latest release of type-is
package which is used in node-req
has a new check in tryNormalizeType
function:
if (typeof value !== 'string') {
return null
}
The release was made today.
Unfortunately, it brakes adonis body parser since body type check stops working and returns false on all types (aka this._isType(request, this.jsonTypes)
).
By default node-req
tries to get the latest type-is
version and hence all the users who made a fresh adonis install in the last few hours wouldn’t be able to get a request body.
I’m not sure whether this issue should be in node-req
(by the way. npm page has a wrong github repo link) or in body-parser repo. So I’ll post it here since it is the main adonis repo.
Package version
“@adonisjs/framework”: “^5.0.13”, “@adonisjs/bodyparser”: “^2.0.9”,
Node.js and npm version
10.15.3
Sample Code (to reproduce the issue)
request.all() or any other request
To reproduce, make a fresh adonis install and do a POST with any body (I tested on application/json
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 18 (5 by maintainers)
Thanks @SAGV for bringing it to the notice. If you guys can confirm the fix, I will close this issue
Awesome @thetutlage it works now!
It’s weird that they released a breaking change in a patch version. Looking into it
I’ve been trying for 6 hours to see what the problem was. I thought it was the only 😢 Thank you @SAGV