Help Angular by taking a 1 minute survey!Go to surveyHome

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; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; } = {})
  body: T | null
  type: HttpEventType.Response
  clone(update: { body?: any; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; } = {}): HttpResponse<any>

  // inherited from common/http/HttpResponseBase
  constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, 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; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; } = {})
      
      constructor(init: { body?: T; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; } = {})
    
Parameters
init object

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

Overload #1
clone(): HttpResponse<T>
      
      clone(): HttpResponse<T>
    
Parameters

There are no parameters.

Returns

HttpResponse<T>


Overload #2
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 object
Returns

HttpResponse<T>


Overload #3
clone<V>(update: { body?: V; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }): HttpResponse<V>
      
      clone<V>(update: { body?: V; headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }): HttpResponse<V>
    
Parameters
update object
Returns

HttpResponse<V>