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

Add formUrl body type #9

Closed
elbywan opened this issue Oct 6, 2017 · 1 comment
Closed

Add formUrl body type #9

elbywan opened this issue Oct 6, 2017 · 1 comment
Assignees
Milestone

Comments

@elbywan
Copy link
Owner

elbywan commented Oct 6, 2017

Sets the content encoding header to "application/x-www-form-urlencoded" and sets the body.

// With a string
wretch("myurl").formUrl("say=Hi&to=Mom").post()

// Provide a simple way to serialize objects (no funky stuff)
wretch("myurl").formUrl({ say: "Hi", to: "Mom"}).post()
@elbywan elbywan added this to the 1.0.0 milestone Oct 6, 2017
@elbywan elbywan self-assigned this Oct 6, 2017
@elbywan elbywan mentioned this issue Oct 6, 2017
elbywan added a commit that referenced this issue Oct 6, 2017
@elbywan
Copy link
Owner Author

elbywan commented Oct 6, 2017

const form = { a: 1, b: { c: 2 }}
const alreadyEncodedForm = "a=1&b=%7B%22c%22%3A2%7D"

wretch("...").formUrl(form).post()
wretch("...").formUrl(alreadyEncodedForm).post()

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

No branches or pull requests

1 participant