-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Serialize integers in multipart forms #761
Conversation
Any updates on this one? I can write more tests if necessary. |
Looks good to me. |
Hi @szastupov! Should we support old past days decisions of the thirdparty libs? I'm not sure. I think here would be better to allow users to register own serializers (and override default ones), but that's will require a bit more work. As for this PR I'm -0. |
@kxepal agree with your objections |
The first reason is when people want to simply pass an object as data parameter to request. They could use json but then you have to do it manually so they fall back to passing object via data. Btw, this case can be covered by a separate patch that adds json parameter to request (again, similar to requests interface). The second case is when server API accepts both arguments and a file (for example). In this case I usually manually convert integers to to strings so I could get used to it, but I found that for some people it's confusing and it takes them time to figure out why the code doesn't work. Tl;DR I just want aiohttp to be a bit more user friendly (it already does a good job), so why not copy copy some ideas from requests? :) |
Provide real example for int use case. Right now I am -1 |
Sending int and receiving string doesn't sound strait forward |
Explicit is better than implicit. By passing an object I'm not sure what the request will be made: with application/json data or multipart/form-data - both can be valid. XML may be?
Ok, assume that's it. Then somehow in your or else code
As the commit that I referenced shows, that idea is not a part of requests ideas, but a legacy of underlying http client. Also buggy as I wrote above.
+1. So I'm -1 as well now. |
Ok, you convinced me about multipart. So, what about providing a convenience method for posting json, something like this:
Which will set content-type header and dump json. What dou you think? |
@szastupov I think that would need a new issue ticket for the further discussion. Let's not mix the ideas (: Closing this one. |
I know this change might be too specific, but users coming from requests are used to passing integers without converting them to strings 1.