ngify
    Preparing search index...

    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.

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    _cancelled: boolean = false

    set by HttpClientTestingBackend

    request: HttpRequest<any>

    Accessors

    Methods

    • Resolve the request by returning an ErrorEvent (e.g. simulating a network failure).

      Parameters

      • error: ErrorEvent
      • Optionalopts: TestRequestErrorOptions

      Returns void

      Http requests never emit an ErrorEvent. Please specify a ProgressEvent.

    • Resolve the request by returning an ProgressEvent (e.g. simulating a network failure).

      Parameters

      • error: ProgressEvent
      • Optionalopts: TestRequestErrorOptions

      Returns void

    • Resolve the request by returning a body plus additional HTTP information (such as response headers) if provided. If the request specifies an expected body type, the body is converted into the requested type. Otherwise, the body is converted to JSON by default.

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

      Parameters

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

      Returns void