Latest
Search
K
Links

API

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

BodyParser

Ƭ BodyParser: function

Type declaration:

▸ (response: RawHttpResponse): HttpResponse‹T›
Parameters:
Name
Type
response

BodyParserImplementation

Ƭ BodyParserImplementation: function

Type declaration:

▸ (rawResponse: RawHttpResponse): Promise‹any›
Parameters:
Name
Type
rawResponse

BodySerializer

Ƭ BodySerializer: function

Type declaration:

▸ (request: HttpOptions): NormalizedHttpBody
Parameters:
Name
Type
request

BufferEncoding

Ƭ BufferEncoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"

ContentTypeMap

Ƭ ContentTypeMap: Record‹keyof typeof ContentTypeRegex, T›

HttpBody

Ƭ HttpBody: object | TypedArray | string

HttpFetch

Ƭ HttpFetch: function

Type declaration:

▸ (): Promise‹HttpResponse‹Body››

HttpHeaders

Ƭ HttpHeaders: Record‹string, string | number | boolean | undefined | null›

HttpInterceptor

HttpInterceptorFunction

Ƭ HttpInterceptorFunction: function

Type declaration:

▸ <Body>(request: HttpFetch‹Body›, options: NormalizedHttpOptions): HttpFetch‹Body›
Type parameters:
Body
Parameters:
Name
Type
request
HttpFetch‹Body›
options

HttpOptions

Ƭ HttpOptions: Partial‹HttpRequestOptions

HttpRequestHandler

Ƭ HttpRequestHandler: function

Type declaration:

▸ (requestOptions: NormalizedHttpOptions): Promise‹RawHttpResponse
Parameters:
Name
Type
requestOptions

MockHttpRequestHandler

Ƭ MockHttpRequestHandler: HttpRequestHandler & object

NormalizedHttpBody

Ƭ NormalizedHttpBody: TypedArray | string | undefined

PromiseFunction

Ƭ PromiseFunction: function

Type declaration:

▸ (): Promise‹T›

RequestMode

Ƭ RequestMode: "navigate" | "same-origin" | "no-cors" | "cors"

Variables

Const DEFAULT_REQUEST_TIMEOUT_MS

DEFAULT_REQUEST_TIMEOUT_MS: number = 5 60 1000
Default request timeout - 5 minutes.

Const DONE

DONE: 4 = 4

Const HEADERS_RECEIVED

HEADERS_RECEIVED: 2 = 2

TypedArray

TypedArray: any

Const symbol

symbol: unique symbol = Symbol('HttpResponseError')

Functions

Const bodyParser

bodyParser(__namedParameters: object): (Anonymous function)
Parameters:
Default value __namedParameters: object= {}
Name
Type
bodyCasing
defaultParser
Returns: (Anonymous function)

Const bodySerializer

bodySerializer(__namedParameters: object): BodySerializer
Parameters:
Default value __namedParameters: object= {}
Name
Type
bodyCasing
Returns: BodySerializer

Const cacheParsedBody

cacheParsedBody<T>(parsedBody: PromiseFunction‹T›): PromiseFunction‹T›
Type parameters:
T
Parameters:
Name
Type
parsedBody
PromiseFunction‹T›
Returns: PromiseFunction‹T›

Const createAsyncBodyHandler

createAsyncBodyHandler<T>(): object
Type parameters:
T
Returns: object
  • call(): Promise‹T›
  • onBodyFailure(failer: function): void
  • onBodyReceived(getter: function): void

Const createErrorInterceptor

createErrorInterceptor(): HttpInterceptorFunction

Const createFormData

createFormData(body: object): FormData
Parameters:
Name
Type
body
object
Returns: FormData

Const createFormDataImpl

createFormDataImpl(object: object, form: FormData, namespace?: undefined | string): FormData
Parameters:
Name
Type
object
object
form
FormData
namespace?
undefined | string
Returns: FormData

Const createHttpResponse

createHttpResponse(__namedParameters: object): HttpResponse
Parameters:
__namedParameters: object
Name
Type
Default
body
undefined | string | Uint8Array‹› | Uint8ClampedArray‹› | Uint16Array‹› | Uint32Array‹› | Int8Array‹› | Int16Array‹› | Int32Array‹› | Float32Array‹› | Float64Array‹›
-
headers
undefined | object
-
status
number
-
url
string
""
Returns: HttpResponse

Const createLoggingInterceptor

createLoggingInterceptor(__namedParameters: object): HttpInterceptorFunction
Parameters:
__namedParameters: object
Name
Type
logger
function

Const createRedirectionInterceptor

createRedirectionInterceptor(__namedParameters: object): HttpInterceptorFunction
Parameters:
Default value __namedParameters: object= {}
Name
Type
Default
redirectionLimit
number
30

Const createSimpleServer

createSimpleServer(): SimpleServer
Returns: SimpleServer

Const deepKeyMap

deepKeyMap(object: any, mapper: function): any
Parameters:
object: any
mapper: function
▸ (key: string): string
Parameters:
Name
Type
key
string
Returns: any

Const defaultHeaders

defaultHeaders(_host: string): object
Parameters:
Name
Type
Default
_host
string
""
Returns: object
  • Accept: string = "application/json,application/vnd.api+json"
  • Content-Type: ContentType = ContentType.JSON

Const encodeArrayBuffer

encodeArrayBuffer(data: TypedArray | string | undefined, encoding: BufferEncoding): Uint8Array‹›
Parameters:
Name
Type
Default
data
TypedArray | string | undefined
""
encoding
"utf8"
Returns: Uint8Array‹›

Const encodeText

encodeText(buffer: ArrayBuffer, encoding: string): string
Parameters:
Name
Type
Default
buffer
ArrayBuffer
-
encoding
string
"utf8"
Returns: string

Const fetchRequestHandler

fetchRequestHandler(fetchRequestHandlerOptions: FetchRequestHandlerOptions): HttpRequestHandler
Creates a new HttpRequestHandler that uses Fetch API underneath. Does not support timeout property. Abort is possible only after headers were received.
Parameters:
Name
Type
Default
Description
fetchRequestHandlerOptions
{}
default Fetch API options attached to all requests
Returns: HttpRequestHandler

Const getBoundaryFromContentTypeHeader

getBoundaryFromContentTypeHeader(header: string[]): string
Parameters:
Name
Type
header
string[]
Returns: string

Const getCaseConverter

getCaseConverter(bodyCasing?: BodyCasing): toCamelCase
Parameters:
Name
Type
bodyCasing?
Returns: toCamelCase

Const getEncodingFromHeaders

getEncodingFromHeaders(headers: HttpResponseHeaders | undefined, fallback: string): string
Parameters:
Name
Type
Default
headers
HttpResponseHeaders | undefined
-
fallback
string
"utf8"
Returns: string

Const getHeader

getHeader(headers: HttpHeaders | undefined, header: string): string | undefined
Parameters:
Name
Type
headers
HttpHeaders | undefined
header
string
Returns: string | undefined

Const getHostname

getHostname(url: string): string
Parameters:
Name
Type
url
string
Returns: string

Const handleRequest

handleRequest(code: number, body: any, contentType: string): Promise‹HttpResponse
Parameters:
Name
Type
Default
code
number
-
body
any
-
contentType
string
ContentType.TEXT
Returns: Promise‹HttpResponse

Const httpRequestHandler

httpRequestHandler(requestHandlerOptions: HttpRequestHandlerOptions): HttpRequestHandler
Creates a new HttpRequestHandler that uses native Node.js HTTP & HTTPS modules underneath. Does not support mode property.
Parameters:
Name
Type
Default
Description
requestHandlerOptions
{}
default native options attached to all requests
Returns: HttpRequestHandler

Const isFormData

isFormData(object: any): object is FormData
Parameters:
Name
Type
object
any
Returns: object is FormData

Const isHttpInterceptorInterface

isHttpInterceptorInterface(interceptor: HttpInterceptor): interceptor is HttpInterceptorInterface
Parameters:
Name
Type
interceptor
Returns: interceptor is HttpInterceptorInterface

Const isHttpRequestError

isHttpRequestError(error: any): error is HttpRequestError
Parameters:
Name
Type
error
any
Returns: error is HttpRequestError

Const isHttpResponseError

isHttpResponseError(error: any): error is HttpResponseError
Parameters:
Name
Type
error
any
Returns: error is HttpResponseError

Const mockRequestHandler

mockRequestHandler(mockOptions: MockOptions): MockHttpRequestHandler
Parameters:
Name
Type
mockOptions

Const noConversion

noConversion(object: any): any
Parameters:
Name
Type
object
any
Returns: any

Const parseHeaders

parseHeaders(headers: Headers): Record‹string, string›
Parameters:
Name
Type
headers
Headers
Returns: Record‹string, string›

Const passthroughParser

passthroughParser(response: RawHttpResponse): object
Parameters:
Name
Type
response
Returns: object
  • parsedBody: any = (response as any).parsedBody || (() => response.arrayBuffer())