Skip to content

requests.post() issues a GET with verify=False on insecure ssl environment #2367

@kevinlondon

Description

@kevinlondon

I did a search to see if I could find any similar issues prior to filing the bug. It seems like something within the way urllib3 is behaving, in particular, but I'm not sure.

I have an API endpoint where GET is disabled so only POST and OPTIONS are valid methods. It works fine when I interact with it when it's hosted on HTTP but when I host it over HTTPS, the response is a 405. It behaves the same if I'm using either requests.post() or requests.Session().post().

Specifically, here's an example of the request / response cycle:

>>> resp = requests.Session().post(url, headers=self._headers, verify=False)
>>> resp.content
'{"code": 405, "total": null, "version": 1, "errors": [{"message": "Method \'GET\' not allowed."}]'

On an HTTP environment, with the same call (including verify=False), I get the expected response. I've also been able to successfully hit the same URL with the same headers using Postman and cURL without issue on the HTTPS server.

Is this a bug with the library or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions