You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")}).
The text was updated successfully, but these errors were encountered:
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")})
.The text was updated successfully, but these errors were encountered: