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:
@@ -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),
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user