workaround fix for an issue in aiohttp.Client

This commit is contained in:
Yun Xu
2018-02-27 21:42:41 -08:00
parent d55e453bd5
commit c39ddd00d3
3 changed files with 21 additions and 1 deletions

View File

@@ -45,6 +45,10 @@ def test_method_not_allowed():
request, response = app.test_client.head('/')
assert response.headers['Allow'] == 'GET'
request, response = app.test_client.post('/')
assert response.headers['Allow'] == 'GET'
@app.post('/')
async def test(request):
return response.json({'hello': 'world'})
@@ -52,7 +56,12 @@ def test_method_not_allowed():
request, response = app.test_client.head('/')
assert response.status == 405
assert set(response.headers['Allow'].split(', ')) == set(['GET', 'POST'])
assert response.headers['Content-Length'] == '40'
assert response.headers['Content-Length'] == '0'
request, response = app.test_client.patch('/')
assert response.status == 405
assert set(response.headers['Allow'].split(', ')) == set(['GET', 'POST'])
assert response.headers['Content-Length'] == '0'
@pytest.fixture