pwsm / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Sending POST request should also set Content-type: application/x-www-form-urlencoded #158

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Creating a POST request with a body does not automatically add a Content-type: 
application/x-www-form-urlencoded header which normally is required.

    h = httlib2.Http()
    h.request('http://example.com', 'POST', urlencode(data))

I would expect it to be sensible to add this header automatically if:

1. You're doing a POST request
2. You're submitting data
3. There isn't an explicit Content-type in the "headers" argument to 
Http.request

Original issue reported on code.google.com by victor.a...@gmail.com on 19 Jul 2011 at 2:25

GoogleCodeExporter commented 8 years ago
+1; does seem sensible, although it might be considered 'magic'. Still, if no 
content-type already exists, certainly seems reasonable to me.

Original comment by jamiesonbecker@gmail.com on 8 Nov 2011 at 5:02

GoogleCodeExporter commented 8 years ago
Too much magic, but I am considering adding some utility functions for making 
form POSTs and file uploading easier.

Original comment by joe.gregorio@gmail.com on 1 Mar 2012 at 3:52