requests-oauthlib icon indicating copy to clipboard operation
requests-oauthlib copied to clipboard

Oauth1 with x-www-form-urlencoded fails for GET/HEAD method

Open syork opened this issue 7 years ago • 1 comments

oauthlib will produce an error if a body is sent with a GET/HEAD method.

        elif http_method.upper() in ('GET', 'HEAD') and has_params:
            raise ValueError('GET/HEAD requests should not include body.')

If our content type is form-urlencoded then we force an empty body.

        if is_form_encoded:
            r.headers['Content-Type'] = CONTENT_TYPE_FORM_URLENCODED
            r.url, headers, r.body = self.client.sign(
                unicode(r.url), unicode(r.method), r.body or '', r.headers)

The libraries conflict and thus will fail if the method is GET/HEAD.

syork avatar Sep 11 '18 15:09 syork

Did you find a solution to this?

jonathangjertsen avatar Aug 22 '20 15:08 jonathangjertsen