Skip to main content
Module

x/attain/mod.ts>Request

Deno API middleware Server
Latest
class Request
import { Request } from "https://deno.land/x/attain@1.1.2/mod.ts";

An interface which provides information about the current request.

Constructors

new
Request(serverRequest: Request, secure?)

Index Signatures

[dynamicProperty: string]: any

Properties

readonly
hasBody: boolean

Is true if the request has a body, otherwise false.

readonly
headers: Headers

The Headers supplied in the request.

readonly
method: SupportMethodType

The HTTP Method used by the request.

readonly
serverRequest: Request

Set to the value of the original Deno server request.

readonly
startDate: number
readonly
url: URL

A parsed URL for the request which complies with the browser standards. When the application's .proxy is true, this value will be based off of the X-Forwarded-Proto and X-Forwarded-Host header values if present in the request.

Methods

accepts(): string[] | undefined

Returns an array of media types, accepted by the requestor, in order of preference. If there are no encodings supplied by the requestor, undefined is returned.

accepts(...types: string[]): string | undefined

For a given set of media types, return the best match accepted by the requestor. If there are no encoding that match, then the method returns undefined.

acceptsCharsets(): string[] | undefined

Returns an array of charsets, accepted by the requestor, in order of preference. If there are no charsets supplied by the requestor, undefined is returned.

acceptsCharsets(...charsets: string[]): string | undefined

For a given set of charsets, return the best match accepted by the requestor. If there are no charsets that match, then the method returns undefined.

acceptsEncodings(): string[] | undefined

Returns an array of encodings, accepted by the requestor, in order of preference. If there are no encodings supplied by the requestor, undefined is returned.

acceptsEncodings(...encodings: string[]): string | undefined

For a given set of encodings, return the best match accepted by the requestor. If there are no encodings that match, then the method returns undefined.

NOTE: You should always supply identity as one of the encodings to ensure that there is a match when the Accept-Encoding header is part of the request.

acceptsLanguages(): string[] | undefined

Returns an array of languages, accepted by the requestor, in order of preference. If there are no languages supplied by the requestor, undefined is returned.

acceptsLanguages(...langs: string[]): string | undefined

For a given set of languages, return the best match accepted by the requestor. If there are no languages that match, then the method returns undefined.

body(options: BodyOptions<"bytes">): BodyBytes
body(options: BodyOptions<"form">): BodyForm
body(options: BodyOptions<"form-data">): BodyFormData
body(options: BodyOptions<"json">): BodyJson
body(options: BodyOptions<"reader">): BodyReader
body(options: BodyOptions<"stream">): BodyStream
body(options: BodyOptions<"text">): BodyText
body(options?: BodyOptions): Body