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

Bug when setting up the body via the form method #1630

Closed
LucasSeveryn opened this issue Jun 5, 2015 · 2 comments
Closed

Bug when setting up the body via the form method #1630

LucasSeveryn opened this issue Jun 5, 2015 · 2 comments

Comments

@LucasSeveryn
Copy link

Example:

fd={'key A to B':'value'}
request.post('http://service.com/upload').form(fd)

will not encode the spaces correctly and therefore the response will not be successful.

@simov
Copy link
Member

simov commented Jun 5, 2015

The problem is not with the encoding, but rather with the usage of the form method.

Notice that the bottom request doesn't have form parameters and a body - http://requestb.in/1emxna81?inspect. This is the result from using the form method:

request.post('http://requestb.in/1emxna81')
      .form({'key A to B':'value'})

I'll investigate that further, in the meantime you can just pass the parameters through the form option:

request.post('http://requestb.in/1emxna81',
      {form:{'key A to B':'value'}})

@simov simov changed the title URL-encoded forms do not encode the form data correctly (spaces) Bug when using the form method with application/x-www-form-urlencoded Jun 5, 2015
@simov simov mentioned this issue Jun 23, 2015
@simov
Copy link
Member

simov commented Jun 23, 2015

@LucasSeveryn I just pushed the fix here #1656 can you pull it and check if it works for you?

@simov simov changed the title Bug when using the form method with application/x-www-form-urlencoded Bug when setting up the body via the form method Jun 23, 2015
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

2 participants