A mock requests that was received and is ready to be answered.
构造函数
属性
属性名 | 类型 | 说明 |
---|
cancelled | | 只读 Whether the request was cancelled after it was sent. |
request | | 声明于构造函数中 |
方法
|
---|
Resolve the request by returning a body plus additional HTTP information (such as response headers) if provided. |
flush(body: ArrayBuffer | Blob | string | number | Object | (string | number | Object | null)[] | null, opts: { headers?: HttpHeaders | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void参数body | Type: ArrayBuffer | Blob | string | number | Object | (string | number | Object | null)[] | null . | opts | Type: {
headers?: HttpHeaders | {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
} . 可选. 默认值是 {} . |
返回值void
|
Both successful and unsuccessful responses can be delivered via flush() . |
|
---|
Resolve the request by returning an ErrorEvent (e.g. simulating a network failure). |
error(error: ErrorEvent, opts: { headers?: HttpHeaders | { [name: string]: string | string[]; }; status?: number; statusText?: string; } = {}): void参数error | Type: ErrorEvent . | opts | Type: {
headers?: HttpHeaders | {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
} . 可选. 默认值是 {} . |
返回值void
|
|
---|
Deliver an arbitrary HttpEvent (such as a progress event) on the response stream for this request. |
event(event: HttpEvent<any>): void参数返回值void
|