Skip to content
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

POST with utf-8 not correctly catched #32

Closed
akhenakh opened this issue Jun 18, 2012 · 3 comments
Closed

POST with utf-8 not correctly catched #32

akhenakh opened this issue Jun 18, 2012 · 3 comments

Comments

@akhenakh
Copy link

The reason #31 does not work seems to be the same problem I have.

I worked on a httpie fork for oauth and httpie is building all requests with:
Content-Type: application/x-www-form-urlencoded; charset=utf-8

The following test in your code will not work correctly as it only test for equality with "Content-Type: application/x-www-form-urlencoded".
Then the POST data will disappear in the signature, here is a simple patch (one line) that's why I'm posting here.

diff --git a/oauth_hook/hook.py b/oauth_hook/hook.py
index b4042fd..3a85a8b 100644
--- a/oauth_hook/hook.py
+++ b/oauth_hook/hook.py
@@ -71,7 +71,7 @@ class OAuthHook(object):
         """
         # See issues #10 and #12
         if ('Content-Type' not in request.headers or \
-            request.headers.get('Content-Type') == 'application/x-www-form-urlencoded') \
+            request.headers.get('Content-Type').startswith('application/x-www-form-urlencoded')) \
             and not isinstance(request.data, basestring):
             data_and_params = dict(request.data.items() + request.params.items())
@prune998
Copy link

same issue here... Thanks for the patch !

maraujop added a commit that referenced this issue Jun 21, 2012
Thanks to @akhenakh for the patch from #GH-32, which fixes #GH-31
@maraujop
Copy link
Owner

Thanks for the patch @akhenakh I've just merged it in and released version 0.4.1 in PyPi.

I've added you to AUTHORS. Great work with your OAuth httpie fork :D

Cheers,
Miguel

@akhenakh
Copy link
Author

Thanks Miguel !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants