Fix response ci header (#1244)

* add unit tests, which should fail

* fix CIDict

* moving CIDict to avoid circular imports

* fix unit tests

* use multidict for headers

* fix cookie

* add version constraint for multidict

* omit test coverage for __main__.py

* make flake8 happy

* consolidate check in for loop

* travisci retry build
This commit is contained in:
7
2018-07-11 01:44:21 -07:00
committed by Raphael Deem
parent becbc5f9ef
commit 334649dfd4
9 changed files with 38 additions and 44 deletions

View File

@@ -25,6 +25,7 @@ def test_cookies():
assert response.text == 'Cookies are: working!'
assert response_cookies['right_back'].value == 'at you'
@pytest.mark.parametrize("httponly,expected", [
(False, False),
(True, True),

View File

@@ -64,6 +64,25 @@ def test_method_not_allowed():
assert response.headers['Content-Length'] == '0'
def test_response_header():
app = Sanic('test_response_header')
@app.get('/')
async def test(request):
return json({
"ok": True
}, headers={
'CONTENT-TYPE': 'application/json'
})
request, response = app.test_client.get('/')
assert dict(response.headers) == {
'Connection': 'keep-alive',
'Keep-Alive': '2',
'Content-Length': '11',
'Content-Type': 'application/json',
}
@pytest.fixture
def json_app():
app = Sanic('json')