{ "id": "api/common/http/HttpResponseBase", "title": "HttpResponseBase", "contents": "\n\n
\n
\n
\n \n API > @angular/common > @angular/common/http\n
\n \n
\n \n
\n

HttpResponseBaselink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

Base class for both HttpResponse and HttpHeaderResponse.

\n\n \n
\n \n \n \n
\n\nabstract class HttpResponseBase {\n constructor(init: { headers?: HttpHeaders; status?: number; statusText?: string; url?: string; }, defaultStatus: number = HttpStatusCode.Ok, defaultStatusText: string = 'OK')\n headers: HttpHeaders\n status: number\n statusText: string\n url: string | null\n ok: boolean\n type: HttpEventType.Response | HttpEventType.ResponseHeader\n}\n\n\n \n \n
\n

Subclasseslink

\n \n\n\n\n\n
\n \n\n
\n\n\n \n\n \n \n \n\n\n\n\n\n\n

Constructorlink

\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n\n \n \n
\n

Super-constructor for all responses.

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

Optional. Default is HttpStatusCode.Ok.

\n \n
\n \n defaultStatusText\n string\n

Optional. Default is 'OK'.

\n \n
\n\n \n\n\n \n\n \n
\n
\n

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

\n\n
\n\n\n\n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n headers: HttpHeaders\n Read-Only\n \n

All response headers.

\n\n \n
\n \n status: number\n Read-Only\n \n

Response status code.

\n\n \n
\n \n statusText: string\n Read-Only\n \n

Textual description of response status code, defaults to OK.

\n\n

Do not depend on this.

\n\n
\n \n url: string | null\n Read-Only\n \n

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

\n\n \n
\n \n ok: boolean\n Read-Only\n \n

Whether the status code falls in the 2xx range.

\n\n \n
\n \n type: HttpEventType.Response | HttpEventType.ResponseHeader\n Read-Only\n \n

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

\n\n \n
\n
\n\n\n\n\n\n \n\n\n
\n
\n\n\n" }