Base class for both HttpResponse and HttpHeaderResponse.
HttpResponse 和 HttpHeaderResponse 的共同基类。
构造函数
Super-constructor for all responses. 所有响应体的上级(super)构造器。 |
constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = 200, defaultStatusText: string = 'OK')参数| init | Type: {
headers?: HttpHeaders;
status?: number;
statusText?: string;
url?: string;
}. | | defaultStatus | Type: number. 可选. 默认值是 200. | | defaultStatusText | Type: string. 可选. 默认值是 'OK'. |
|
The single parameter accepted is an initialization hash. Any properties of the response passed there will override the default values. 接受的唯一参数是一个初始化哈希值。所传进来的响应对象的任何属性都会覆盖这些默认值。 |
属性
| 属性名 | 类型 | 说明 |
|---|
| headers | | 只读 All response headers. 所有响应头。 |
| status | | 只读 Response status code. 响应的状态码。 |
| statusText | | 只读 Textual description of response status code. 响应状态码的文本描述。 Do not depend on this. 请不要在代码中依赖它。 |
| url | | 只读 URL of the resource retrieved, or null if not available. 所接收的资源的 URL,如果不可用则为 null。 |
| ok | | 只读 Whether the status code falls in the 2xx range. 状态码是否位于 2xx 范围内。 |
| type | | 只读 Type of the response, narrowed to either the full response or the header. 响应对象的类型,窄化为完整的响应对象或只有响应头。 |