Interface IRequest

A SuperTest Request object with some helper functions.

Hierarchy

  • Test

    Hierarchy

    • IRequest

Properties

[toStringTag]: string
app?: any
bearer: ((token: string) => IRequest)

Type declaration

    • (token: string): IRequest
    • Helper function that adds an authorization header with value 'Bearer '.

      Parameters

      • token: string

        The bearer token to add.

      Returns IRequest

cookies: string
json: (() => IRequest)

Type declaration

    • (): IRequest
    • Helper function that sets the Accept header to 'application/json'.

      Returns IRequest

method: string
url: string

Methods

  • Returns void

  • Parameters

    • type: string

    Returns IRequest

  • Parameters

    • Optional agent: Agent

    Returns IRequest

  • Parameters

    • field: string
    • file: MultipartValueSingle
    • Optional options: string | { contentType?: string; filename?: string }

    Returns IRequest

  • Parameters

    • user: string
    • pass: string
    • Optional options: { type: "basic" | "auto" }
      • type: "basic" | "auto"

    Returns IRequest

  • Parameters

    • token: string
    • options: { type: "bearer" }
      • type: "bearer"

    Returns IRequest

  • Parameters

    • Optional val: boolean

    Returns IRequest

  • Parameters

    • cert: string | Buffer | Buffer[] | string[]

    Returns IRequest

  • Attaches a callback for only the rejection of the Promise.

    Returns

    A Promise for the completion of the callback.

    Type Parameters

    Type Parameters

    • TResult = never

    Parameters

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

      The callback to execute when the Promise is rejected.

    Returns Promise<Response | TResult>

  • Parameters

    • cert: string | Buffer | Buffer[] | string[]

    Returns IRequest

  • Returns IRequest

  • Returns IRequest

  • Parameters

    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • status: number
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • status: number
    • body: any
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • checker: ((res: Response) => any)
        • (res: Response): any
        • Parameters

          • res: Response

          Returns any

    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • body: string
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • body: RegExp
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • body: Object
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • field: string
    • val: string
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • field: string
    • val: RegExp
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • name: string
    • val: MultipartValue

    Returns IRequest

  • Parameters

    • fields: { [fieldName: string]: MultipartValue }
      • [fieldName: string]: MultipartValue

    Returns IRequest

  • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

    Returns

    A Promise for the completion of the callback.

    Parameters

    • Optional onfinally: null | (() => void)

      The callback to execute when the Promise is settled (fulfilled or rejected).

    Returns Promise<Response>

  • Parameters

    • field: string

    Returns string

  • Parameters

    • Optional enable: boolean

    Returns IRequest

  • Parameters

    • cert: string | Buffer | Buffer[] | string[]

    Returns IRequest

  • Parameters

    • size: number

    Returns IRequest

  • Parameters

    • callback: ((res: Response) => boolean)
        • (res: Response): boolean
        • Parameters

          • res: Response

          Returns boolean

    Returns IRequest

  • Parameters

    • name: "error"
    • handler: ((err: any) => void)
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns IRequest

  • Parameters

    • name: "progress"
    • handler: ((event: ProgressEvent) => void)
        • (event: ProgressEvent): void
        • Parameters

          • event: ProgressEvent

          Returns void

    Returns IRequest

  • Parameters

    • name: "response"
    • handler: ((response: Response) => void)
        • (response: Response): void
        • Parameters

          • response: Response

          Returns void

    Returns IRequest

  • Parameters

    • name: string
    • handler: ((event: any) => void)
        • (event: any): void
        • Parameters

          • event: any

          Returns void

    Returns IRequest

  • Parameters

    • parser: Parser

    Returns IRequest

  • Returns IRequest

  • Parameters

    • cert: string | Buffer | Buffer[] | string[] | { passphrase: string; pfx: string | Buffer }

    Returns IRequest

  • Parameters

    • stream: WritableStream
    • Optional options: object

    Returns Writable

  • Parameters

    • val: string | object

    Returns IRequest

  • Parameters

    • n: number

    Returns IRequest

  • Parameters

    • type: string

    Returns IRequest

  • Parameters

    • Optional count: number
    • Optional callback: CallbackHandler

    Returns IRequest

  • Parameters

    • Optional data: string | object

    Returns IRequest

  • Parameters

    • serializer: Serializer

    Returns IRequest

  • Parameters

    • app: any
    • path: string

    Returns string

  • Parameters

    • field: object

    Returns IRequest

  • Parameters

    • field: string
    • val: string

    Returns IRequest

  • Parameters

    • field: "Cookie"
    • val: string[]

    Returns IRequest

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Returns

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

    Type Parameters

    Type Parameters

    • TResult1 = Response

    • TResult2 = never

    Parameters

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

      The callback to execute when the Promise is resolved.

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

      The callback to execute when the Promise is rejected.

    Returns Promise<TResult1 | TResult2>

  • Parameters

    • ms: number | { deadline?: number; response?: number }

    Returns IRequest

  • Parameters

    • Optional enabled: boolean

    Returns IRequest

  • Parameters

    • val: string

    Returns IRequest

  • Parameters

    • field: string

    Returns IRequest

  • Parameters

    • fn: Plugin

    Returns IRequest

  • Returns IRequest

  • Parameters

    • data: string | Buffer
    • Optional encoding: string

    Returns boolean

Generated using TypeDoc