Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def index(self, request: Request):
return text(self.greet())
def get_cat(self, cat_id: str): return text('5')
async def index(self, request: Request, user: Optional[User]):
assert hasattr(request, 'identity')
assert isinstance(request.identity, User)
return text(request.identity.name)
def update_cat(self): return text('2')
async def echo_chunked_text(request):
text_from_client = await request.text()
return text(text_from_client)
def alive(self):
return text('Good')
async def set_cookies(name: FromQuery(str), value: FromQuery(str)):
response = text('Setting cookie')
response.set_cookie(Cookie(name.encode(), value.encode()))
return response
def create_cat(self): return text('3')
def get_cat(self, cat_id: str): return text('1')
def text(self, value: str, status: int = 200) -> Response:
"""Returns a response with text/plain content, and given status (default HTTP 200 OK)."""
return text(value, status)