Skip to main content

Class: Request

@ima/core.Request

Wrapper for the ExpressJS request, exposing only the necessary minimum.

Constructors

constructor

new Request()

Properties

_request

Protected Optional _request: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

The current ExpressJS request object, or null if running at the client side.

Defined in

packages/core/src/router/Request.ts:14

Accessors

$dependencies

Static get $dependencies(): never[]

Returns

never[]

Defined in

packages/core/src/router/Request.ts:16

Methods

getBody

getBody(): any

Returns body of request.

Returns

any

Defined in

packages/core/src/router/Request.ts:68


getCookieHeader

getCookieHeader(): undefined | string

Returns the Cookie HTTP header value.

Returns

undefined | string

The value of the Cookie header.

Defined in

packages/core/src/router/Request.ts:45


getFile

getFile(): any

Returns uploaded file to server and meta information.

Returns

any

Defined in

packages/core/src/router/Request.ts:52


getFiles

getFiles(): any

Returns uploaded files to server with their meta information.

Returns

any

Defined in

packages/core/src/router/Request.ts:60


getHeader

getHeader(header): null | string

Returns the specified HTTP request header.

Parameters

NameType
headerstring

Returns

null | string

Defined in

packages/core/src/router/Request.ts:75


getIP

getIP(): null | string

Returns the remote IP address of the request.

Returns

null | string

Defined in

packages/core/src/router/Request.ts:82


getIPs

getIPs(): string[]

Returns array of IP addresses specified in the “X-Forwarded-For” request header.

Returns

string[]

Defined in

packages/core/src/router/Request.ts:90


getMethod

getMethod(): string

Returns

string

Defined in

packages/core/src/router/Request.ts:94


getPath

getPath(): string

Returns the path part of the URL to which the request was made.

Returns

string

The path to which the request was made.

Defined in

packages/core/src/router/Request.ts:36


init

init(request): void

Initializes the request using the provided ExpressJS request object.

Parameters

NameTypeDescription
requestRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>The ExpressJS request object representing the current request. Use null at the client side.

Returns

void

Defined in

packages/core/src/router/Request.ts:27