|
|
|
@ -13,7 +13,7 @@ import {ActivatedRoute} from '../routing/ActivatedRoute'
|
|
|
|
|
* Enumeration of different HTTP verbs.
|
|
|
|
|
* @todo add others?
|
|
|
|
|
*/
|
|
|
|
|
export type HTTPMethod = 'post' | 'get' | 'patch' | 'put' | 'delete' | 'unknown';
|
|
|
|
|
export type HTTPMethod = 'post' | 'get' | 'patch' | 'put' | 'delete' | 'unknown'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the given item is a valid HTTP verb.
|
|
|
|
@ -36,9 +36,9 @@ export interface HTTPProtocol {
|
|
|
|
|
* Interface that describes the origin IP address of a request.
|
|
|
|
|
*/
|
|
|
|
|
export interface HTTPSourceAddress {
|
|
|
|
|
address: string;
|
|
|
|
|
family: 'IPv4' | 'IPv6';
|
|
|
|
|
port: number;
|
|
|
|
|
address: string
|
|
|
|
|
family: 'IPv4' | 'IPv6'
|
|
|
|
|
port: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -55,43 +55,43 @@ export interface DataContainer {
|
|
|
|
|
export class Request extends ScopedContainer implements DataContainer {
|
|
|
|
|
|
|
|
|
|
/** The cookie manager for the request. */
|
|
|
|
|
public readonly cookies: HTTPCookieJar;
|
|
|
|
|
public readonly cookies: HTTPCookieJar
|
|
|
|
|
|
|
|
|
|
/** The URL suffix of the request. */
|
|
|
|
|
public readonly url: string;
|
|
|
|
|
public readonly url: string
|
|
|
|
|
|
|
|
|
|
/** The fully-qualified URL of the request. */
|
|
|
|
|
public readonly fullUrl: string;
|
|
|
|
|
public readonly fullUrl: string
|
|
|
|
|
|
|
|
|
|
/** The HTTP verb of the request. */
|
|
|
|
|
public readonly method: HTTPMethod;
|
|
|
|
|
public readonly method: HTTPMethod
|
|
|
|
|
|
|
|
|
|
/** True if the request was made via TLS. */
|
|
|
|
|
public readonly secure: boolean;
|
|
|
|
|
public readonly secure: boolean
|
|
|
|
|
|
|
|
|
|
/** The request HTTP protocol version. */
|
|
|
|
|
public readonly protocol: HTTPProtocol;
|
|
|
|
|
public readonly protocol: HTTPProtocol
|
|
|
|
|
|
|
|
|
|
/** The URL path, stripped of query params. */
|
|
|
|
|
public readonly path: string;
|
|
|
|
|
public readonly path: string
|
|
|
|
|
|
|
|
|
|
/** The raw parsed query data from the request. */
|
|
|
|
|
public readonly rawQueryData: {[key: string]: string | string[] | undefined};
|
|
|
|
|
public readonly rawQueryData: {[key: string]: string | string[] | undefined}
|
|
|
|
|
|
|
|
|
|
/** The inferred query data. */
|
|
|
|
|
public readonly query: {[key: string]: any};
|
|
|
|
|
public readonly query: {[key: string]: any}
|
|
|
|
|
|
|
|
|
|
/** True if the request was made via XMLHttpRequest. */
|
|
|
|
|
public readonly isXHR: boolean;
|
|
|
|
|
public readonly isXHR: boolean
|
|
|
|
|
|
|
|
|
|
/** The origin IP address of the request. */
|
|
|
|
|
public readonly address: HTTPSourceAddress;
|
|
|
|
|
public readonly address: HTTPSourceAddress
|
|
|
|
|
|
|
|
|
|
/** The associated response. */
|
|
|
|
|
public readonly response: Response;
|
|
|
|
|
public readonly response: Response
|
|
|
|
|
|
|
|
|
|
/** The media types accepted by the client. */
|
|
|
|
|
public readonly mediaTypes: string[];
|
|
|
|
|
public readonly mediaTypes: string[]
|
|
|
|
|
|
|
|
|
|
/** Input parsed from the request */
|
|
|
|
|
public readonly parsedInput: {[key: string]: any} = {}
|
|
|
|
|