helapkg / hela

:icecream: Powerful software development experience and management. Enhancing @tc39 JS, @denoland and @nodejs, because we need a bit of magic. :sparkles: You can think of it as Cargo for the JavaScript ecosystem.
Mozilla Public License 2.0
331 stars 41 forks source link

Body or fields not reflecting the data passed in request params for route type DELETE #110

Closed ojus93 closed 6 years ago

ojus93 commented 6 years ago

Body or fields not reflecting the data passed in request params for route type DELETE.

Issue : No data is being accepted in the request in json or form data or any other format for that matter.

Reason: After evaluating the library saw that in utils file there is validity check of method which is not allowing the data to be set in fields/body. PFB the function : utils.isValid = function isValid (method) { return ['GET', 'HEAD', 'DELETE'].indexOf(method.toUpperCase()) === -1 }

I think , this function should not have DELETE method, as by the HTTP protocol, we can send data in the DELETE API. Let me know, if I should send a PR to fix this, or there is something else that I can do to handle this.

tunnckoCore commented 6 years ago

It's absolutely intentional, yes. Yes we can send data with DELETE http request, but isn't recommended and almost all of the other libraries for such things you can see same check too.

There's a note in the readme too and you can disable this behavior with strict: false.

ojus93 commented 6 years ago

Okay will check for an alternate solution. Closing this issue. Thanks for the quick reply.