Dynamic module nock

Index

Functions

Functions

nock(host: string, options?: Options): Scope

Parameters

  • host: string
  • options?: Options optional

Returns

Scope

recorder: Recorder

Options: Options

optional public allowUnmocked?: boolean

Recorder: Recorder

public play(): Array<string>

Returns

Array<string>

public rec(capture?: boolean)

Parameters

  • capture?: boolean optional

Scope: Scope

public defaultReplyHeaders(headers: Object): Scope

Parameters

  • headers: Object

Returns

Scope

public delete(path: string, data?: string): Scope

Parameters

  • path: string
  • data?: string optional

Returns

Scope

public done()

public filteringPath(regex: RegExp, replace: string): Scope

Parameters

  • regex: RegExp
  • replace: string

Returns

Scope

public filteringPath(fn: (path: string) => string): Scope

Parameters

  • fn: (path: string) => string

Returns

Scope

public filteringRequestBody(regex: RegExp, replace: string): Scope

Parameters

  • regex: RegExp
  • replace: string

Returns

Scope

public filteringRequestBody(fn: (path: string) => string): Scope

Parameters

  • fn: (path: string) => string

Returns

Scope

public get(path: string, data?: string): Scope

Parameters

  • path: string
  • data?: string optional

Returns

Scope

public head(path: string): Scope

Parameters

  • path: string

Returns

Scope

public intercept(path: string, verb: string, body?: string, options?: any): Scope

Parameters

  • path: string
  • verb: string
  • body?: string optional
  • options?: any optional

Returns

Scope

public isDone(): boolean

Returns

boolean

public log(out: () => void): Scope

Parameters

  • out: () => void

Returns

Scope

public matchHeader(name: string, value: string): Scope

Parameters

  • name: string
  • value: string

Returns

Scope

public persist(): Scope

Returns

Scope

public post(path: string, data?: string): Scope

Parameters

  • path: string
  • data?: string optional

Returns

Scope

public put(path: string, data?: string): Scope

Parameters

  • path: string
  • data?: string optional

Returns

Scope

public reply(responseCode: number, body?: string, headers?: Object): Scope

Parameters

  • responseCode: number
  • body?: string optional
  • headers?: Object optional

Returns

Scope

public reply(responseCode: number, body?: Object, headers?: Object): Scope

Parameters

  • responseCode: number
  • body?: Object optional
  • headers?: Object optional

Returns

Scope

public reply(responseCode: number, callback: (uri: string, body: string) => string, headers?: Object): Scope

Parameters

  • responseCode: number
  • callback: (uri: string, body: string) => string
  • headers?: Object optional

Returns

Scope

public replyWithFile(responseCode: number, fileName: string): Scope

Parameters

  • responseCode: number
  • fileName: string

Returns

Scope

public restore()

cleanAll()