def test_002_other_body(self): response = Response(123) eq_(response.body, b'123') eq_(response.content_type, 'text/plain') response = Response('hello') eq_(response.body, b'hello') eq_(response.content_type, 'text/plain')
def test_001_json_body(self): response = Response({'test': 'test'}) eq_(response.body, b'{"test": "test"}') eq_(response.content_type, 'application/json') response = Response(['test', 'test2']) eq_(response.body, b'["test", "test2"]') eq_(response.content_type, 'application/json')
async def _capa_handler(d, name): eq_(name, 'test') capa_resp = Response({'response': 'ok'}) return capa_resp
async def _capa_handler(d): return Response()
def test_001_dict_body(self): response = Response({'test': 'test'}) eq_(response.body, b'{"test": "test"}') eq_(response.content_type, 'application/json')