kodepandai / lunox

Laravel-Flavoured Nodejs Framework
https://lunox.js.org
MIT License
75 stars 8 forks source link

[lunox-core] json should not be parsed as form data #63

Closed axmad386 closed 3 months ago

axmad386 commented 3 months ago

Current implementation of body parser is when request method is not get, everything is parsed via formidable. This will introduces incorrect behavior. For example request with method put but sent application/json it will threat single array as not array.

agent.put("/url").send({ids: ["randomid"]}) 
// body will parsed as 
{ ids: "randomid"} --> it should be {ids: ["randomid"]}