Skip to main content
Module

x/mandarinets/deps.ts>Request

Mandarine.TS is a typescript, decorator-driven framework that allows you to create server-side applications. Mandarine.TS provides a range of built-in solutions such as Dependency Injection, Components, ORM and more. Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application.
Latest
class Request
import { Request } from "https://deno.land/x/mandarinets@v2.3.2/deps.ts";

An interface which provides information about the current request.

Constructors

new
Request(
serverRequest: ServerRequest,
proxy?,
secure?,
)

Properties

readonly
hasBody: boolean

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

readonly
headers: Headers

The Headers supplied in the request.

readonly
ip: string

Request remote address. When the application's .proxy is true, the X-Forwarded-For will be used to determine the requesting remote address.

readonly
ips: string[]

When the application's .proxy is true, this will be set to an array of IPs, ordered from upstream to downstream, based on the value of the header X-Forwarded-For. When false an empty array is returned.

readonly
method: HTTPMethods

The HTTP Method used by the request.

readonly
secure: boolean

Shortcut to request.url.protocol === "https:".

readonly
serverRequest: ServerRequest

Set to the value of the original Deno server request.

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<"form">): BodyForm
body(options: BodyOptions<"form-data">): BodyFormData
body(options: BodyOptions<"json">): BodyJson
body(options: BodyOptions<"raw">): BodyRaw
body(options: BodyOptions<"reader">): BodyReader
body(options: BodyOptions<"text">): BodyText
body(options?: BodyOptions): Body