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

Don't set a default filename when sending multipart form #83

Open
ArtanisCV opened this issue Aug 27, 2019 · 0 comments
Open

Don't set a default filename when sending multipart form #83

ArtanisCV opened this issue Aug 27, 2019 · 0 comments

Comments

@ArtanisCV
Copy link

ArtanisCV commented Aug 27, 2019

Currently grequests always sets a filename when creating a multipart post request https://github.com/levigross/grequests/blob/master/request.go#L312 . This leads to inconsistent behaviors with python's requests.

More specifically, lots of web servers (e.g., go's net/http, python's flask) rely on the existence of 'filename' when parsing a multipart form. If 'filename' exists, the field will be parsed as a file (and put in Request.FormFile, for example); otherwise it will be parsed as a normal value (and put in Request.FormValue, for example).

As grequests always sets a filename, all fields will be parsed as files, while python's requests allows providing non-file fields using syntax like requests.post(xxx, files={'key': (None, json.dumps("{}"), "application/json")}).

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