TestRequest
A mock requests that was received and is ready to be answered.
constructor
TestRequestcancelled
booleanWhether the request was cancelled after it was sent.
request
HttpRequest<any>flush
voidResolve 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().
string | number | boolean | Object | ArrayBuffer | Blob | (string | number | boolean | Object | null)[] | null{ headers?: HttpHeaders | { [name: string]: string | string[]; } | undefined; status?: number | undefined; statusText?: string | undefined; }voiderror
2 overloadsResolve the request by returning an ErrorEvent (e.g. simulating a network failure).
ErrorEventTestRequestErrorOptions | undefinedvoidResolve the request by returning an ProgressEvent (e.g. simulating a network failure).
ProgressEvent<EventTarget>TestRequestErrorOptions | undefinedvoidevent
voidDeliver an arbitrary HttpEvent (such as a progress event) on the response stream for this
request.
HttpEvent<any>voidDescription
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.