Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Request

import { Request } from "https://raw.githubusercontent.com/mandarineorg/mandarinets/master/deps.ts";

An interface which provides information about the current request.

class Request {
constructor(
serverRequest: ServerRequest | NativeRequest,
proxy?,
secure?,
);
get hasBody(): boolean;
get headers(): Headers;
get ip(): string;
get ips(): string[];
get method(): HTTPMethods;
get secure(): boolean;
get originalRequest(): ServerRequest | NativeRequest;
get url(): URL;
 
accepts(): string[] | undefined;
accepts(...types: string[]): string | undefined;
accepts(...types: string[]): string | string[] | undefined;
acceptsCharsets(): string[] | undefined;
acceptsCharsets(...charsets: string[]): string | undefined;
acceptsCharsets(...charsets: string[]): string[] | string | undefined;
acceptsEncodings(): string[] | undefined;
acceptsEncodings(...encodings: string[]): string | undefined;
acceptsEncodings(...encodings: string[]): string[] | string | undefined;
acceptsLanguages(): string[] | undefined;
acceptsLanguages(...langs: string[]): string | undefined;
acceptsLanguages(...langs: string[]): string[] | string | 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;
body(options?: BodyOptions): Body | BodyReader | BodyStream;
}

§Constructors

§
new Request(serverRequest: ServerRequest | NativeRequest, proxy?, secure?)
[src]

§Properties

§
hasBody: boolean readonly
[src]

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

§
headers: Headers readonly
[src]

The Headers supplied in the request.

§
ip: string readonly
[src]

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

§
ips: string[] readonly
[src]

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.

§
method: HTTPMethods readonly
[src]

The HTTP Method used by the request.

§
secure: boolean readonly
[src]

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

§
originalRequest: ServerRequest | NativeRequest readonly
[src]

Set to the value of the original Deno server request.

§
url: URL readonly
[src]

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
[src]

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
[src]

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.

accepts(...types: string[]): string | string[] | undefined
[src]
§
acceptsCharsets(): string[] | undefined
[src]

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
[src]

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.

acceptsCharsets(...charsets: string[]): string[] | string | undefined
[src]
§
acceptsEncodings(): string[] | undefined
[src]

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
[src]

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.

acceptsEncodings(...encodings: string[]): string[] | string | undefined
[src]
§
acceptsLanguages(): string[] | undefined
[src]

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
[src]

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.

acceptsLanguages(...langs: string[]): string[] | string | undefined
[src]
§
body(options: BodyOptions<"bytes">): BodyBytes
[src]
body(options: BodyOptions<"form">): BodyForm
[src]
body(options: BodyOptions<"form-data">): BodyFormData
[src]
body(options: BodyOptions<"json">): BodyJson
[src]
body(options: BodyOptions<"reader">): BodyReader
[src]
body(options: BodyOptions<"stream">): BodyStream
[src]
body(options: BodyOptions<"text">): BodyText
[src]
body(options?: BodyOptions): Body
[src]
body(options?: BodyOptions): Body | BodyReader | BodyStream
[src]