Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@http('GET', r'/empty-data/?')
async def empty_data(self, request: web.Request) -> str:
return ''
@http('GET', r'/count/2/?')
@count_invocations_2
async def count_2(self, request: web.Request) -> str:
return str(self.invocation_count)
@http('GET', r'/authorization/?')
async def authorization(self, request: web.Request) -> str:
return request._cache.get('auth').login if request._cache.get('auth') else ''
@http('GET', r'/count/1/?')
@count_invocations_1
async def count_1(self, request: web.Request) -> str:
return str(self.invocation_count)
@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'
})
@http('GET', r'/count/0/?')
@count_invocations_0
async def count_0(self, request: web.Request) -> str:
return str(self.invocation_count)
@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; '
})
@http('GET', r'/forwarded-for/?')
async def forwarded_for(self, request: web.Request) -> str:
return RequestHandler.get_request_ip(request) or ''
@http('GET', r'/tuple/?')
async def test_tuple(self, request: web.Request) -> Tuple:
return (200, 'test tuple', {
'X-Tuple': 'test'
})
@http('GET', r'/middleware-before/?')
async def middleware_before(self, request: web.Request) -> str:
self.function_triggered = True
return 'test'