Example #1
0
async def view_html(request):
    """Return HTML content and a custom header."""
    response = html("<b>HTML OK</b>")
    response.add_header(b'x-time', f"{time.time()}".encode())
    return response
Example #2
0
def req_ok(request):
    return html('ok')
Example #3
0
 async def home():
     return html(EXAMPLE_HTML)
Example #4
0
 async def home():
     return html(content, status)
Example #5
0
 def html(self, data, status: int = 200) -> Response:
     """
     Returns a response with text/html content, and given status
     (default HTTP 200 OK).
     """
     return html(data, status)