コード例 #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/',
        )
コード例 #2
0
ファイル: main.py プロジェクト: kerkeslager/fwx
def handler(request):
    return fwx.TextResponse(
        content='Hello, world\n',
    )
コード例 #3
0
 def test_sets_content_type(self):
     response = fwx.TextResponse('Hello, world\n')
     self.assertEqual(response.content_type, 'text/plain; charset=utf-8')