Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "client"

Index

Type aliases

RequestOptions

RequestOptions: CoreOptions & RetryOptions

Response

Response: Response & ExtraResponse

Variables

Const $setTimeout

$setTimeout: setTimeout = setTimeout

Const FORWARD_HEADERS

FORWARD_HEADERS: string[] = ['x-request-id', 'x-canary']

Const MONGO_REG

MONGO_REG: RegExp = /^[0-9a-f]{24}$/i

Const RETRIABLE_ERRORS

RETRIABLE_ERRORS: string[] = ['ECONNRESET', 'ENOTFOUND', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN']

Functions

assertRes

  • .

    Type parameters

    • T

    Parameters

    Returns T

    a Response body or throw a error.

delay

  • delay(ms: number): Promise<unknown>
  • .

    Parameters

    • ms: number

    Returns Promise<unknown>

    a promise that delay with given ms time.

isSuccess

  • isSuccess(res: request.RequestResponse): boolean
  • .

    Parameters

    • res: request.RequestResponse

    Returns boolean

    true if response' statusCode in [200, 300)

urlJoin

  • urlJoin(base?: string, to?: string): string
  • Parameters

    • Default value base: string = ""
    • Default value to: string = ""

    Returns string

Generated using TypeDoc