Beispiel #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
Beispiel #2
0
def req_ok(request):
    return html('ok')
Beispiel #3
0
 async def home():
     return html(EXAMPLE_HTML)
Beispiel #4
0
 async def home():
     return html(content, status)
Beispiel #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)