Skip to main content

Class: Response

Defined in: packages/core/src/router/Response.ts:18

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

Constructors

new Response()

new Response(): Response

Returns

Response

Properties

_cookieTransformFunction

protected _cookieTransformFunction: CookieTransformFunction

Defined in: packages/core/src/router/Response.ts:35

Transform function for cookie value.


_internalCookieStorage

protected _internalCookieStorage: Map<string, { options: CookieOptions; value: string; }>

Defined in: packages/core/src/router/Response.ts:27

Internal cookie storage for Set-Cookie header.


_internalHeadersStorage

protected _internalHeadersStorage: UnknownParameters = {}

Defined in: packages/core/src/router/Response.ts:31


_response?

protected optional _response: Response

Defined in: packages/core/src/router/Response.ts:23

The ExpressJS response object, or undefined if running at the client side.

Accessors

$dependencies

Get Signature

get static $dependencies(): never[]

Defined in: packages/core/src/router/Response.ts:40

Returns

never[]

Methods

getResponseParams()

getResponseParams(): object

Defined in: packages/core/src/router/Response.ts:172

Return object which contains response headers and cookie.

Returns

object

cookie: Map<string, { options: CookieOptions; value: string; }>

headers

headers: UnknownParameters


init()

init(response, cookieTransformFunction): Response

Defined in: packages/core/src/router/Response.ts:53

Initializes this response wrapper with the provided ExpressJS response object.

Parameters

response

Response

The ExpressJS response, or null if the code is running at the client side.

cookieTransformFunction

Returns

Response

This response.


redirect()

redirect(url, options): void

Defined in: packages/core/src/router/Response.ts:80

Redirects the client to the specified location, with the specified redirect HTTP response code.

For full list of HTTP response status codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Use this method only at the server side.

Parameters

url

string

The URL to which the client should be redirected. @param[status=302] The HTTP status code to send to the client.

options

Partial<RouteOptions> = ...

Returns

void

This response.


setCookie()

setCookie(name, value, options): this

Defined in: packages/core/src/router/Response.ts:117

Sets a cookie, which will be sent to the client with the response.

Parameters

name

string

The cookie name.

value

The cookie value, will be converted to string.

string | number | boolean

options

CookieOptions = {}

Cookie attributes. Only the attributes listed in the type annotation of this field are supported. For documentation and full list of cookie attributes see http://tools.ietf.org/html/rfc2965#page-5

Returns

this

This response.


setHeader()

setHeader(name, value): Response

Defined in: packages/core/src/router/Response.ts:153

Sets a header, which will be sent to the client with the response.

Parameters

name

string

The header name.

value

unknown

The header value, will be

Returns

Response

This response.