W3cubDocs

/Angular

@angular/common/http

entry-point

Implements an HTTP client API for Angular apps that relies on the XMLHttpRequest interface exposed by browsers.

Includes testability features, typed request and response objects, request and response interception, observable APIs, and streamlined error handling.

For usage information, see the HTTP Client guide.

Entry point exports

NgModules

HttpClientJsonpModule

Configures the dependency injector for HttpClient with supporting services for JSONP. Without this module, Jsonp requests reach the backend with method JSONP, where they are rejected.

HttpClientModule

Configures the dependency injector for HttpClient with supporting services for XSRF. Automatically imported by HttpClientModule.

HttpClientXsrfModule

Configures XSRF protection support for outgoing requests.

Classes

FetchBackend

Uses fetch to send requests to a backend server.

HttpBackend

A final HttpHandler which will dispatch the request via browser HTTP APIs to a backend.

HttpClient

Performs HTTP requests. This service is available as an injectable class, with methods to perform HTTP requests. Each request method has multiple signatures, and the return type varies based on the signature that is called (mainly the values of observe and responseType).

HttpContext

Http context stores arbitrary user defined values and ensures type safety without actually knowing the types. It is backed by a Map and guarantees that keys do not clash.

HttpContextToken

A token used to manipulate and access values stored in HttpContext.

HttpErrorResponse

A response that represents an error or failure, either from a non-successful HTTP status, an error while executing the request, or some other failure which occurred during the parsing of the response.

HttpHandler

Transforms an HttpRequest into a stream of HttpEvents, one of which will likely be a HttpResponse.

HttpHeaderResponse

A partial HTTP response which only includes the status and header data, but no response body.

HttpHeaders

Represents the header configuration options for an HTTP request. Instances are immutable. Modifying methods return a cloned instance with the change. The original object is never changed.

HttpParams

An HTTP request/response body that represents serialized parameters, per the MIME type application/x-www-form-urlencoded.

HttpRequest

An outgoing HTTP request with an optional typed body.

HttpResponse

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

HttpResponseBase

Base class for both HttpResponse and HttpHeaderResponse.

HttpUrlEncodingCodec

Provides encoding and decoding of URL parameter and query-string values.

HttpXhrBackend

Uses XMLHttpRequest to send requests to a backend server.

HttpXsrfTokenExtractor

Retrieves the current XSRF token to use with the next outgoing request.

JsonpClientBackend

Processes an HttpRequest with the JSONP method, by performing JSONP style requests.

JsonpInterceptor

Identifies requests with the method JSONP and shifts them to the JsonpClientBackend.

Functions

provideHttpClient

Configures Angular's HttpClient service to be available for injection.

withFetch

Configures the current HttpClient instance to make requests using the fetch API.

withInterceptors

Adds one or more functional-style HTTP interceptors to the configuration of the HttpClient instance.

withInterceptorsFromDi

Includes class-based interceptors configured using a multi-provider in the current injector into the configured HttpClient instance.

withJsonpSupport

Add JSONP support to the configuration of the current HttpClient instance.

withNoXsrfProtection

Disables XSRF protection in the configuration of the current HttpClient instance.

withRequestsMadeViaParent

Configures the current HttpClient instance to make requests via the parent injector's HttpClient instead of directly.

withXsrfConfiguration

Customizes the XSRF protection for the configuration of the current HttpClient instance.

Structures

HttpDownloadProgressEvent

A download progress event.

HttpEventType

Type enumeration for the different kinds of HttpEvent.

HttpFeature

A feature for use when configuring provideHttpClient.

HttpFeatureKind

Identifies a particular kind of HttpFeature.

HttpInterceptor

Intercepts and handles an HttpRequest or HttpResponse.

HttpParameterCodec

A codec for encoding and decoding parameters in URLs.

HttpParamsOptions

Options used to construct an HttpParams instance.

HttpProgressEvent

Base interface for progress events.

HttpSentEvent

An event indicating that the request was sent to the server. Useful when a request may be retried multiple times, to distinguish between retries on the final event stream.

HttpStatusCode

Http status codes. As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

HttpUploadProgressEvent

An upload progress event.

HttpUserEvent

A user-defined event.

Types

HTTP_INTERCEPTORS

A multi-provider token that represents the array of registered HttpInterceptor objects.

HttpEvent

Union type for all possible events on the response stream.

HttpHandlerFn

Represents the next interceptor in an interceptor chain, or the real backend if there are no further interceptors.

HttpInterceptorFn

An interceptor for HTTP requests made via HttpClient.

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/http