Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body handling for get and delete methods #68

Closed
vlad-zhukov opened this issue Jul 31, 2018 · 5 comments
Closed

Body handling for get and delete methods #68

vlad-zhukov opened this issue Jul 31, 2018 · 5 comments

Comments

@vlad-zhukov
Copy link

vlad-zhukov commented Jul 31, 2018

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!

@MatteoGioioso
Copy link

Any update on this?

@niftylettuce
Copy link
Collaborator

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.

@niftylettuce
Copy link
Collaborator

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

@niftylettuce
Copy link
Collaborator

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

@niftylettuce
Copy link
Collaborator

v3.0.0 is released which fixes this issue 🎉

npm install frisbee@latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants