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

HttpResponseBase

Base class for both HttpResponse and HttpHeaderResponse.

      
      abstract class 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
}
    

Constructor

Super-constructor for all responses.

constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = 200, defaultStatusText: string = 'OK')
      
      constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = 200, defaultStatusText: string = 'OK')
    
Parameters
init object
defaultStatus number

Optional. Default is 200.

defaultStatusText string

Optional. Default is 'OK'.

The single parameter accepted is an initialization hash. Any properties of the response passed there will override the default values.

Properties

Property Description
headers: HttpHeaders Read-only.

All response headers.

status: number Read-only.

Response status code.

statusText: string Read-only.

Textual description of response status code.

Do not depend on this.

url: string | null Read-only.

URL of the resource retrieved, or null if not available.

ok: boolean Read-only.

Whether the status code falls in the 2xx range.

type: HttpEventType.Response | HttpEventType.ResponseHeader Read-only.

Type of the response, narrowed to either the full response or the header.