import { type RequestContext } from "https://deno.land/x/ayonli_jsext@v0.9.72/http.ts";
Represents the context of an HTTP request. It provides additional information about the request and allows for upgrading the connection to a WebSocket.
Properties
The remote address of the client. This property may not be available in
worker environments (such as Cloudflare Workers) or when the server is
started via deno serve
.
Prolongs the request's lifetime until the promise is resolved. Only available in workers environments such as Cloudflare Workers.
Methods
Creates an SSE (server-sent events) endpoint for sending events to the client.
Upgrades the request to a WebSocket connection.
Starts a timer that can be used to compute the duration of an operation
identified by a unique name
. When the operation completes, call
timeEnd()
with the same name to stop the timer.
This function is similar to the console.time
, except it logs the
duration to the Server-Timing
header of the response and will be
displayed in the browser's devtools.
Optionally, we can provide a description
that will be used as the title
when displaying the timing metrics.
We could use a total
label to measure the total time spent, which has
special meaning in the Google Chrome browser. However, it may not be
accurate since multiple operations can happen at the same time
concurrently.