decklin / curlicue

OAuth wrapper for cURL on the command line
Other
117 stars 12 forks source link

Issues with --data #2

Closed pjump closed 9 years ago

pjump commented 9 years ago

I was trying to use this to create bitbucket repos via oauth.

Deletion with curlic works reliably fine, but POSTing fails. The differences between the two is POST requests have a JSON body.

I'm not sure whether it's bitbucket or curlicue that's failing here.

pjump commented 9 years ago

The issue is how curlicue always tries to interpret the request body even if the content type is "application/json" and not "application/x-www-form-urlencoded". In shouldn't be setting url_params from the body if content type (the header) is application/json. (Line No 100)

pjump commented 9 years ago

In cany case, thanks for the awesome tool. I absolutely love it.

decklin commented 9 years ago

Thanks for the report -- this is correct, if the body content-type is something else then we should ignore it for signature purposes: http://oauth.net/core/1.0a/#anchor13 Thinking about how best to deal with this.

decklin commented 9 years ago

Let me know how this works for you: https://github.com/decklin/curlicue/compare/data-not-params

It adds a curlicue option, so you have to use it in conjunction with setting the content-type header, something like

curlicue -P -- -d '{"foo": "bar"}' -H "Content-Type: application/json" http://example.com/whatever
pjump commented 9 years ago

Works great. Thanks!