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

http/request: Add :set_form_data method #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

daurnimator
Copy link
Owner

This adds a convenience method for turning a request into a urlencoded form data POST request

@coveralls
Copy link

coveralls commented May 4, 2016

Coverage Status

Coverage decreased (-0.07%) to 86.267% when pulling ad28aa3 on request.set_form_data into 929ba0c on master.

@daurnimator
Copy link
Owner Author

daurnimator commented May 4, 2016

Why does form data deserve it's own function when there are so many other formats to choose from?
e.g. json, xml, etc. Obviously we don't want to depend on json/xml libraries, so we can't add helpers for all common formats.

See also #7


The main rationale seems to be that people expect there to be a :set_form_data-like function in a HTTP library.

  • luasocket's http has a code-path for it
  • prosody has a code-path for it
  • curl has a commad line option for it

@coveralls
Copy link

coveralls commented May 4, 2016

Coverage Status

Coverage increased (+0.02%) to 86.356% when pulling c8b2c21 on request.set_form_data into 929ba0c on master.

@daurnimator
Copy link
Owner Author

I think you need to replace %20 with +.

@daurnimator
Copy link
Owner Author

If this gets merged we also need decoding: you can't use query_args as it doesn't decode + to space. Cc @leafo

@coveralls
Copy link

coveralls commented Nov 15, 2016

Coverage Status

Coverage increased (+0.01%) to 86.233% when pulling 903e59c on request.set_form_data into 8b7f4ba on master.

@coveralls
Copy link

coveralls commented Jan 9, 2017

Coverage Status

Coverage increased (+0.01%) to 88.048% when pulling 23840c4 on request.set_form_data into 95b6ec8 on master.

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

Successfully merging this pull request may close these issues.

2 participants