Пример #1
0
    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')
Пример #2
0
    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')
Пример #3
0
 async def _capa_handler(d, name):
     eq_(name, 'test')
     capa_resp = Response({'response': 'ok'})
     return capa_resp
Пример #4
0
 async def _capa_handler(d):
     return Response()
Пример #5
0
 def test_001_dict_body(self):
     response = Response({'test': 'test'})
     eq_(response.body, b'{"test": "test"}')
     eq_(response.content_type, 'application/json')