def test_leaves_path_intact(self): router = fwx.route_on_subpath( routes={ 'foo': lambda request: fwx.TextResponse('foo'), 'bar': lambda request: fwx.TextResponse(request.path), 'baz': lambda request: fwx.TextResponse('baz'), }, ) self.assertEqual( router(fwx.Request('GET', '/bar/bara/anne/')).content, '/bar/bara/anne/', )
def handler(request): return fwx.TextResponse( content='Hello, world\n', )
def test_sets_content_type(self): response = fwx.TextResponse('Hello, world\n') self.assertEqual(response.content_type, 'text/plain; charset=utf-8')