pytest-httpbin icon indicating copy to clipboard operation
pytest-httpbin copied to clipboard

Connection reset when posting data to ssl status route

Open ckoopmann opened this issue 4 years ago • 0 comments

When posting data to the 'status/{status_code}' route on the ssl version it fails with a connection reset. This happens neither on the local http server nor on the remote https://httpbin.org (see example), nor when sending a post request without data payload.

Therefore it seems to deviate from the behaviour of httpbin.org which is probably unintended.

import requests
from pytest_httpbin.certs import where
test_data = {'foo': 'bar'}
status_route = '/status/200'

# Fails with requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
def test_post_data_to_status_route_ssl(httpbin_secure):
    url = httpbin_secure.url
    response = requests.post(url + status_route, verify=where(), data=test_data)
    assert response.status_code == 200

# Passes
def test_post_without_data_to_status_route(httpbin):
    url = httpbin.url
    response = requests.post(url + status_route)
    assert response.status_code == 200

# Passes
def test_post_data_to_status_route(httpbin):
    url = httpbin.url
    response = requests.post(url + status_route, data=test_data)
    assert response.status_code == 200

# Passes
def test_post_data_to_status_route_ssl_remote_httpbin():
    url = "https://httpbin.org"
    response = requests.post(url + status_route, data=test_data)
    assert response.status_code == 200

ckoopmann avatar Jul 30 '20 10:07 ckoopmann