Skip to content
Myr

Fix Content-Type validation in OAuth1 callable

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Idan Gazit · committed by Donald Stufft · parent 9217a25 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:requests/auth.py+3 added-2 removed
44 unmodified lines
45 resource_owner_secret, callback_uri, signature_method,46 signature_type, rsa_key, verifier)4748 def __call__(self, r):49 contenttype = r.headers.get('Content-Type')50 if (r.files or50 r.headers['Content-Type'] != 'application/x-www-form-urlencoded'):51 (contenttype and contenttype != 'application/x-www-form-urlencoded')):5253 # XXX TODO can we use body signatures with a non formencoded body?54 if self.client.signature_type == SIGNATURE_TYPE_BODY:55 raise ValueError('Body signatures may not be used with non-form-urlencoded content')
3 unmodified lines
59 body = u''60 alter_body = False # we shouldn't touch the body61 else:62 body = r.data # OAuthLib is cool with both strings and dicts.62 if isinstance(str, body):63 if isinstance(body, str):64 # XXX gross hack. We must pass unicode...65 body = unicode(body, 'utf-8')66 alter_body = True67
127 unmodified lines