Try to keep the header too if content-type is application/x-www-form-urlencoded
authorayanamist <ayanamist@gmail.com>
Tue, 28 Aug 2012 07:24:09 +0000 (15:24 +0800)
committerayanamist <ayanamist@gmail.com>
Tue, 28 Aug 2012 07:24:09 +0000 (15:24 +0800)
requests/auth.py

index 64d61ce..8b0aeb5 100644 (file)
@@ -96,7 +96,8 @@ class OAuth1(AuthBase):
                 unicode(r.full_url), unicode(r.method), None, r.headers)
         elif decoded_body != None and contenttype in (CONTENT_TYPE_FORM_URLENCODED, ''):
             # Normal signing
-            r.headers['Content-Type'] = CONTENT_TYPE_FORM_URLENCODED
+            if not contenttype:
+                r.headers['Content-Type'] = CONTENT_TYPE_FORM_URLENCODED
             r.url, r.headers, r.data = self.client.sign(
                 unicode(r.full_url), unicode(r.method), r.data, r.headers)
         else: