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

HttpResponseBase

npm Package @angular/common
Module import { HttpResponseBase } from '@angular/common/http';
Source common/http/src/response.ts

Overview

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

Description

Base class for both HttpResponse and HttpHeaderResponse.

Subclasses

Constructor

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

Super-constructor for all responses.

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

Members

      
      get headers: HttpHeaders
    

All response headers.


      
      get status: number
    

Response status code.


      
      get statusText: string
    

Textual description of response status code.

Do not depend on this.


      
      get url: string | null
    

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


      
      get ok: boolean
    

Whether the status code falls in the 2xx range.


      
      get type: HttpEventType.Response | HttpEventType.ResponseHeader
    

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