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

Considering a change to the body option behaviour #265

Closed
alextes opened this issue Jan 22, 2017 · 1 comment
Closed

Considering a change to the body option behaviour #265

alextes opened this issue Jan 22, 2017 · 1 comment

Comments

@alextes
Copy link
Contributor

alextes commented Jan 22, 2017

Looking at a lot of other libs in designing #264 I feel encoding an object assigned to the body property as querystring by default is quite possibly leading to the incorrect use of Got. More so when offering users some shortcut for common requests like other libs do, via the current json option. I'd suggest we do one of the following:

  1. Create a ‘shortcut’ property for JSON and URL-encoded bodies. They would function as a flag. Automatically setting the Content-Type and stringifying if the body is assigned an object. With neither set, assigning an object to the body property would not be accepted. Same as node’s request.end() .

  2. Drop the default URL-encoding and only accept a string, buffer, or a readableStream as the body.

@alextes
Copy link
Contributor Author

alextes commented May 20, 2017

#297 fixed this one going with option 1.

@alextes alextes closed this as completed May 20, 2017
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

1 participant