Beispiel #1
0
    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/',
        )
Beispiel #2
0
def handler(request):
    return fwx.TextResponse(
        content='Hello, world\n',
    )
Beispiel #3
0
 def test_sets_content_type(self):
     response = fwx.TextResponse('Hello, world\n')
     self.assertEqual(response.content_type, 'text/plain; charset=utf-8')