Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/hex/src/fw/service/deps.ts>oak.HttpRequest

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
class oak.HttpRequest
implements ServerRequest
import { oak } from "https://deno.land/x/hex@0.6.5/src/fw/service/deps.ts";
const { HttpRequest } = oak;

An abstraction which wraps a Request from Deno's flash server. The constructor takes a Deferred which it will resolve when the response is ready.

This request can be used in situations where there isn't a specific method to respond with, but where a Promise<Response> is accepted as a value. It is specifically designed to work with Deno's flash server.

Constructors

new
HttpRequest(
request: Request,
deferred: Deferred<Response>,
upgradeWebSocket?: UpgradeWebSocketFn,
)

Properties

readonly
headers: Headers
readonly
method: string
readonly
remoteAddr: string | undefined
readonly
url: string

Methods

error(reason?: any): void
getBody(): ServerRequestBody
respond(response: Response): Promise<void>
upgrade(options?: UpgradeWebSocketOptions): WebSocket