Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IRequest

Hierarchy

Index

Constructors

constructor

  • new IRequest(method: string, url: string): IRequest

Properties

cookies

cookies: string

method

method: string

url

url: string

Methods

abort

  • abort(): void

accept

  • accept(type: string): this

agent

  • agent(agent?: any): this

attach

  • attach(field: string, file: MultipartValueSingle, options?: string | { contentType?: string; filename?: string }): this

auth

  • auth(user: string, pass: string, options?: { type: "basic" | "auto" }): this
  • auth(token: string, options: { type: "bearer" }): this

buffer

  • buffer(val?: boolean): this

ca

  • ca(cert: any | any[]): this

catch

  • catch<TResult>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<IResponse | TResult>
  • Attaches a callback for only the rejection of the Promise.

    Type parameters

    • TResult = never

    Parameters

    • Optional onrejected: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null

      The callback to execute when the Promise is rejected.

    Returns Promise<IResponse | TResult>

    A Promise for the completion of the callback.

cert

  • cert(cert: any | any[]): this

clearTimeout

  • clearTimeout(): this

disableTLSCerts

  • disableTLSCerts(): this

end

field

  • field(name: string, val: MultipartValue): this
  • field(fields: {}): this

get

  • get(field: string): string

http2

  • http2(enable?: boolean): this

key

  • key(cert: any | any[]): this

maxResponseSize

  • maxResponseSize(size: number): this

ok

  • ok(callback: (res: IResponse) => boolean): this

on

  • on(name: "error", handler: (err: any) => void): this
  • on(name: "progress", handler: (event: ProgressEvent) => void): this
  • on(name: "response", handler: (response: IResponse) => void): this
  • on(name: string, handler: (event: any) => void): this

parse

part

  • part(): this

pfx

  • pfx(cert: any | any[] | { passphrase: string; pfx: string | any }): this

pipe

  • pipe(stream: any, options?: object): any

query

  • query(val: object | string): this

redirects

  • redirects(n: number): this

responseType

  • responseType(type: string): this

retry

send

  • send(data?: string | object): this

serialize

set

  • set(field: object): this
  • set(field: string, val: string): this
  • set(field: "Cookie", val: string[]): this

then

  • then<TResult1, TResult2>(onfulfilled?: ((value: IResponse) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>
  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type parameters

    • TResult1 = IResponse

    • TResult2 = never

    Parameters

    • Optional onfulfilled: ((value: IResponse) => TResult1 | PromiseLike<TResult1>) | undefined | null

      The callback to execute when the Promise is resolved.

    • Optional onrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null

      The callback to execute when the Promise is rejected.

    Returns Promise<TResult1 | TResult2>

    A Promise for the completion of which ever callback is executed.

timeout

  • timeout(ms: number | { deadline?: number; response?: number }): this

trustLocalhost

  • trustLocalhost(enabled?: boolean): this

type

  • type(val: string): this

unset

  • unset(field: string): this

use

withCredentials

  • withCredentials(): this

write

  • write(data: string | any, encoding?: string): boolean

Generated using TypeDoc