HttpResponse

A full HTTP response, including a typed response body (which may be null if one was not returned).

一个完整的 HTTP 响应对象,包括一个带类型的响应体(如果没返回内容,则为 null)。

class HttpResponse<T> extends HttpResponseBase { constructor(init: {...}) get body: T | null get type: HttpEventType.Response clone(update: {...}): HttpResponse<any> // 继承自 common/http/HttpResponseBase constructor(init: {...}, defaultStatus: number = 200, defaultStatusText: string = 'OK') get headers: HttpHeaders get status: number get statusText: string get url: string | null get ok: boolean get type: HttpEventType.Response | HttpEventType.ResponseHeader }

说明

HttpResponse is a HttpEvent available on the response event stream.

HttpResponse 是一个用于事件响应流的 HttpEvent

构造函数

Construct a new HttpResponse.

构造一个新的 HttpResponse

constructor(init: { body?: T | null; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; } = {})

参数

init

Type: { body?: T | null; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }.

可选. 默认值是 {}.

属性

属性名类型说明
body只读

The response body, or null if one was not returned.

响应体,如果没有返回内容则为 null

type只读

方法

3 个重载形式...

clone(): HttpResponse<T>

参数

没有参数。

返回值

HttpResponse<T>


clone(update: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }): HttpResponse<T>

参数

update

Type: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }.

返回值

HttpResponse<T>


clone<V>(update: { body?: V | null; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }): HttpResponse<V>

参数

update

Type: { body?: V | null; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }.

返回值

HttpResponse<V>