How to use the tomodachi.transport.http.http function in tomodachi

To help you get started, we’ve selected a few tomodachi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/empty-data/?')
    async def empty_data(self, request: web.Request) -> str:
        return ''
github kalaspuff / tomodachi / tests / services / decorated_functions_service.py View on Github external
    @http('GET', r'/count/2/?')
    @count_invocations_2
    async def count_2(self, request: web.Request) -> str:
        return str(self.invocation_count)
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/authorization/?')
    async def authorization(self, request: web.Request) -> str:
        return request._cache.get('auth').login if request._cache.get('auth') else ''
github kalaspuff / tomodachi / tests / services / decorated_functions_service.py View on Github external
    @http('GET', r'/count/1/?')
    @count_invocations_1
    async def count_1(self, request: web.Request) -> str:
        return str(self.invocation_count)
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/test-charset/?')
    async def test_charset(self, request: web.Request) -> web.Response:
        return web.Response(body='test', status=200, headers={
            'Content-Type': 'text/plain; charset=utf-8'
        })
github kalaspuff / tomodachi / tests / services / decorated_functions_service.py View on Github external
    @http('GET', r'/count/0/?')
    @count_invocations_0
    async def count_0(self, request: web.Request) -> str:
        return str(self.invocation_count)
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/test-weird-content-type/?')
    async def test_weird_content_type(self, request: web.Request) -> web.Response:
        return web.Response(body='test', status=200, headers={
            'Content-Type': 'text/plain; '
        })
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/forwarded-for/?')
    async def forwarded_for(self, request: web.Request) -> str:
        return RequestHandler.get_request_ip(request) or ''
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/tuple/?')
    async def test_tuple(self, request: web.Request) -> Tuple:
        return (200, 'test tuple', {
            'X-Tuple': 'test'
        })
github kalaspuff / tomodachi / tests / services / http_service.py View on Github external
    @http('GET', r'/middleware-before/?')
    async def middleware_before(self, request: web.Request) -> str:
        self.function_triggered = True
        return 'test'