This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

HttpResponse

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

See more...

      
      class HttpResponse<T> extends HttpResponseBase {
  constructor(init: {...})
  body: T | null
  type: HttpEventType.Response
  clone(update: {...}): HttpResponse<any>

  // inherited from common/http/HttpResponseBase
  constructor(init: {...}, defaultStatus: number = 200, defaultStatusText: string = 'OK')
  headers: HttpHeaders
  status: number
  statusText: string
  url: string | null
  ok: boolean
  type: HttpEventType.Response | HttpEventType.ResponseHeader
}
    

Description

HttpResponse is a HttpEvent available on the response event stream.

Constructor

Construct a new HttpResponse.

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

Parameters

init

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

Optional. Default is {}.

Properties

Property Description
body: T | null Read-only.

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

type: HttpEventType.Response Read-only.

Methods

3 overloads...

clone(): HttpResponse<T>
      
      clone(): HttpResponse<T>
    

Parameters

There are no parameters.

Returns

HttpResponse<T>


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

Parameters

update

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

Returns

HttpResponse<T>


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

Parameters

update

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

Returns

HttpResponse<V>