Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Api

Http request

- Api:
    method: GET 
    baseURL: http://abc.com
    url: /test/{class}
    headers:
      Authorization: Bearer ...
    query: 
      name: abc
    params:
      class*: A
    validate:
      - Status: [200, 204]

Hierarchy

Index

Constructors

constructor

  • Parameters

    Returns Api

Properties

->

->: string

Expose a tag

<-

<-: string | string[]

Extends from a expose tag

async

async: boolean

Run async

baseURL

baseURL: string

Request base URL

Optional benchmark

benchmark: { wrk: IWrk }

Test benchmark base on wrk

Type declaration

  • wrk: IWrk

    Execute wrk command line to test benchmark

body

body: any

Request body

Optional curl

curl: string

Load from curl command

debug

debug: boolean | "curl" | "details" | "request" | "response"

How to log for debugging

depends

depends: boolean

Only validate for the before step

description

description: string

Description

disabled

disabled: boolean

Ignore this, not run

Optional docs

docs: { headers?: string[]; md?: { tags?: string[] }; responseHeaders?: string[]; swagger?: Operation }

Generate to document

Type declaration

  • Optional headers?: string[]

    Only doc these request headers

  • Optional md?: { tags?: string[] }

    Config for markdown document

    • Optional tags?: string[]

      Group API document

  • Optional responseHeaders?: string[]

    Only doc these response headers

  • Optional swagger?: Operation

    Config for swagger document

headers

headers: any

Request headers

ignoreError

ignoreError: boolean

Keep run the next when got error

method

method: Method

Http method

params

params: Record<string, any>

Request params which is declare on url

query

query: Record<string, any>

Request query string

response

response: { data: any; headers: {}; status: number; statusText: string }

Response object

Type declaration

  • data: any

    Response data

  • headers: {}

    Response header

    • [key: string]: string
  • status: number

    Response status code

  • statusText: string

    Response status text

Optional saveTo

saveTo: string

Save response to file

slient

slient: boolean

Not show log

testIt

testIt: boolean

Only allow run it then ignore others which not set testIt or set it to false

time

time: number

Execution time

timeout

timeout: number

Set timeout for the request

title

title: string

Step title

url

url: string

Request url

validate

validate: Validate[]

Validate after request done

var

var: string | {}

Set data after request done

string: set response data to this var
object: set customize response to each properties in this var

vars

vars: any

Declare global variable