Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TestRequest

A mock requests that was received and is ready to be answered.

This interface allows access to the underlying HttpRequest, and allows responding with HttpEvents or HttpErrorResponses.

Hierarchy

  • TestRequest

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

request

request: HttpRequest<any>

Accessors

cancelled

  • get cancelled(): boolean

Methods

error

  • error(error: ErrorEvent, opts?: { headers?: HttpHeaders | {}; status?: number; statusText?: string }): void
  • Resolve the request by returning an ErrorEvent (e.g. simulating a network failure).

    Parameters

    • error: ErrorEvent
    • Default value opts: { headers?: HttpHeaders | {}; status?: number; statusText?: string } = {}
      • Optional headers?: HttpHeaders | {}
      • Optional status?: number
      • Optional statusText?: string

    Returns void

event

  • Deliver an arbitrary HttpEvent (such as a progress event) on the response stream for this request.

    Parameters

    Returns void

flush

  • flush(body: ArrayBuffer | Blob | string | number | Object | (string | number | Object)[] | null, opts?: { headers?: HttpHeaders | {}; status?: number; statusText?: string }): void
  • Resolve the request by returning a body plus additional HTTP information (such as response headers) if provided.

    Both successful and unsuccessful responses can be delivered via flush().

    Parameters

    • body: ArrayBuffer | Blob | string | number | Object | (string | number | Object)[] | null
    • Default value opts: { headers?: HttpHeaders | {}; status?: number; statusText?: string } = {}
      • Optional headers?: HttpHeaders | {}
      • Optional status?: number
      • Optional statusText?: string

    Returns void

Generated using TypeDoc