HttpResponse • Angular 日本語版

API

    
      class HttpResponse<T> extends HttpResponseBase {  constructor(init?: { body?: T | null | undefined; headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }): HttpResponse<T>;  readonly body: T | null;  readonly type: HttpEventType.Response;  clone(): HttpResponse<T>;  clone(update: { headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }): HttpResponse<T>;  clone<V>(update: { body?: V | null | undefined; headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }): HttpResponse<V>;  readonly override headers: HttpHeaders;  readonly override status: number;  readonly override statusText: string;  readonly override url: string | null;  readonly override ok: boolean;  readonly override redirected?: boolean | undefined;  readonly override responseType?: ResponseType | undefined;}
    
    

@paraminit{ body?: T | null | undefined; headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }

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

@paramupdate{ headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }

@paramupdate{ body?: V | null | undefined; headers?: HttpHeaders | undefined; status?: number | undefined; statusText?: string | undefined; url?: string | undefined; redirected?: boolean | undefined; responseType?: ResponseType | undefined; }

@deprecated

With HTTP/2 and later versions, this will incorrectly remain set to 'OK' even when the status code of a response is not 200.

Textual description of response status code, defaults to OK.

Do not depend on this.

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

Whether the status code falls in the 2xx range.

Indicates whether the HTTP response was redirected during the request. This property is only available when using the Fetch API using withFetch() When using the default XHR Request this property will be undefined

Indicates the type of the HTTP response, based on how the request was made and how the browser handles the response.

This corresponds to the type property of the Fetch API's Response object, which can indicate values such as:

  • 'basic': A same-origin response, allowing full access to the body and headers.
  • 'cors': A cross-origin response with CORS enabled, exposing only safe response headers.
  • 'opaque': A cross-origin response made with no-cors, where the response body and headers are inaccessible.
  • 'opaqueredirect': A response resulting from a redirect followed in no-cors mode.
  • 'error': A response representing a network error or similar failure.

This property is only available when using the Fetch-based backend (via withFetch()). When using Angular's (XHR) backend, this value will be undefined.

Description

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

HttpResponse is a HttpEvent available on the response event stream.