Options
All
  • Public
  • Public/Protected
  • All
Menu

A class that represents an HTTP request from a client.

Hierarchy

Implements

Index

Constructors

constructor

  • new Request(clientRequest: IncomingMessage, serverResponse: ServerResponse): Request

Properties

Readonly address

The origin IP address of the request.

bypassTimeout

bypassTimeout: boolean = false

If true, the response lifecycle will not time out and send errors.

Protected clientRequest

clientRequest: IncomingMessage

Readonly cookies

cookies: HTTPCookieJar

The cookie manager for the request.

Protected factories

factories: Collection<AbstractFactory<unknown>> = ...

Collection of factories registered with this container.

Readonly fullUrl

fullUrl: string

The fully-qualified URL of the request.

Protected instances

instances: Collection<InstanceRef> = ...

Collection of singleton instances produced by this container.

Readonly isXHR

isXHR: boolean

True if the request was made via XMLHttpRequest.

Readonly mediaTypes

mediaTypes: string[]

The media types accepted by the client.

Readonly method

method: HTTPMethod

The HTTP verb of the request.

Readonly parsedInput

parsedInput: {} = {}

Input parsed from the request

Type declaration

  • [key: string]: any

Readonly path

path: string

The URL path, stripped of query params.

Readonly protocol

protocol: HTTPProtocol

The request HTTP protocol version.

Readonly query

query: {}

The inferred query data.

Type declaration

  • [key: string]: any

Readonly rawQueryData

rawQueryData: {}

The raw parsed query data from the request.

Type declaration

  • [key: string]: string | string[] | undefined

Readonly response

response: Response

The associated response.

Readonly secure

secure: boolean

True if the request was made via TLS.

Protected serverResponse

serverResponse: ServerResponse

Protected staticOverrides

staticOverrides: Collection<{ base: StaticInstantiable<any>; override: StaticInstantiable<any> }> = ...

Collection of static-class overrides registered with this container.

Readonly uploadedFiles

uploadedFiles: {} = {}

Files parsed from the request.

Type declaration

Readonly url

url: string

The URL suffix of the request.

Protected waitingResolveCallbacks

waitingResolveCallbacks: Collection<{ callback: (t: unknown) => unknown; key: any }> = ...

Collection of callbacks waiting for a dependency key to be resolved.

Methods

accepts

  • accepts(type: string): boolean
  • Returns true if the request accepts the given media type.

    Parameters

    • type: string

      a mimetype, or the short forms json, xml, or html

    Returns boolean

cloneTo

file

getDependencies

getExistingInstance

  • getExistingInstance(key: any): any

getHeader

  • getHeader(name: string): undefined | string | string[]

getStaticOverride

hasInstance

  • hasInstance(key: any): boolean

hasKey

  • hasKey(key: any): boolean

hasStaticOverride

input

  • input(key?: string): unknown

make

  • make<T>(target: any, ...parameters: any[]): T
  • Create an instance of the given target. The target can either be a DependencyKey registered with this container (in which case, the singleton value will be returned), or an instantiable class.

    If the instantiable class has the Injectable decorator, its injectable parameters will be automatically injected into the instance.

    Type parameters

    • T

    Parameters

    • target: any
    • Rest ...parameters: any[]

    Returns T

makeByStaticOverride

onResolve

  • onResolve<T>(key: any): Promise<T>
  • Get a Promise that resolves the first time the given dependency key is resolved by the application. If it has already been resolved, the Promise will resolve immediately.

    Type parameters

    • T

    Parameters

    • key: any

    Returns Promise<T>

Protected produceFactory

purge

register

registerFactory

registerNamed

registerProducer

  • registerProducer(name: any, producer: () => any): Request

registerSingleton

  • registerSingleton<T>(key: any, value: T): Request

registerSingletonInstance

  • registerSingletonInstance<T>(staticClass: any, instance: T): Request

registerStaticOverride

release

resolve

resolveAndCreate

  • resolveAndCreate(key: any, ...parameters: any[]): any
  • Resolve the dependency key. If a singleton value for that key already exists in this container, return that value. Otherwise, use the factory an given parameters to produce and return the value.

    Parameters

    • key: any
    • Rest ...parameters: any[]

    Returns any

toNative

  • toNative(): IncomingMessage

wants

  • wants(): "unknown" | "html" | "json" | "xml"

withoutParentScopes

  • withoutParentScopes<T>(closure: () => T): T
  • Execute a closure on this container, disabling parent-resolution. Effectively, the closure will have access to this container as if it were NOT a scoped container, and only contained its factories.

    Type parameters

    • T

    Parameters

    • closure: () => T
        • (): T
        • Returns T

    Returns T

Static fromParent

Static getContainer

Static realizeContainer

  • realizeContainer<T>(container: T): T
Extollo Logo

extollo (v. latin) - to lift up, to elevate

Extollo is a free & libre application framework in TypeScript.