ladjs/frisbee

Body handling for get and delete methods

vlad-zhukov opened this issue · 5 comments

Currently Frisbee converts body into a query string for get and delete methods. That's weird because it's an artificial limitation and there is no way to workaround it. On the other hand it requires additional tooling to add a query string to an url.

I propose to bring get and delete methods in line with the rest of methods and introduce a params option, that will stringify params and add it to url. I would be happy to send PRs!

Any update on this?

There is a new option being added to v3.0.0 which will be released later today. I will post another comment here which will inform you how to workaround this with the new option, it's pretty simple.

However I should inform you that according to https://tools.ietf.org/html/rfc7231 and also https://stackoverflow.com/questions/978061/http-get-with-request-body it is not a standard nor is there a semantic definition for having a payload in GET, HEAD, DELETE, and CONNECT requests.

A payload within a [GET,HEAD|DELETE|CONNECT] request message has no defined semantics;
sending a payload body on a [GET,HEAD|DELETE|CONNECT] request might cause some existing
implementations to reject the request.

Also node-fetch itself does not allow a body on GET nor HEAD:

https://github.com/bitinn/node-fetch/blob/master/src/request.js#L75-L78

I've fixed this and it will be released in v3.0.0 later today.

v3.0.0 is released which fixes this issue 🎉

npm install frisbee@latest