5 lines
19 KiB
JSON
5 lines
19 KiB
JSON
{
|
|
"id": "api/common/http",
|
|
"title": "@angular/common/http",
|
|
"contents": "\n\n<article>\n <div class=\"breadcrumb-container\">\n <div class=\"breadcrumb\">\n <script type=\"application/ld+json\">\n {\n \"@context\": \"http://schema.org\",\n \"@type\": \"BreadcrumbList\",\n \"itemListElement\": [\n { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/common\", \"name\": \"@angular/common\" } },\n { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/common/http\", \"name\": \"@angular/common/http\" } }\n ]\n }\n </script>\n <a href=\"/api\">API</a> > <a href=\"api/common\">@angular/common</a>\n </div>\n <div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/packages/common/http/PACKAGE.md?message=docs(...)%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/PACKAGE.md\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n </div>\n \n<header class=\"api-header\">\n <h1 id=\"angularcommonhttp\">@angular/common/http<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#angularcommonhttp\"><i class=\"material-icons\">link</i></a></h1>\n <label class=\"api-type-label NaN\">entry-point</label>\n \n \n \n</header>\n\n <aio-toc class=\"embedded\"></aio-toc>\n\n <div class=\"api-body\">\n <p>Implements an HTTP client API for Angular apps that relies on the <code>XMLHttpRequest</code> interface exposed by browsers.</p>\n\n <p>Includes testability features, typed request and response objects, request and response interception,\nobservable APIs, and streamlined error handling.</p>\n<p>For usage information, see the <a href=\"guide/http\">HTTP Client</a> guide.</p>\n\n\n \n\n\n \n\n <h2 id=\"entry-point-exports\">Entry point exports<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#entry-point-exports\"><i class=\"material-icons\">link</i></a></h2>\n \n \n \n \n \n <section class=\"export-list\">\n <h3 id=\"ngmodules\">NgModules<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#ngmodules\"><i class=\"material-icons\">link</i></a></h3>\n <table class=\"is-full-width list-table\">\n \n <tbody><tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpClientJsonpModule\">HttpClientJsonpModule</a></code></td>\n <td>\n \n <p>Configures the <a href=\"guide/glossary#injector\">dependency injector</a> for <code><a href=\"api/common/http/HttpClient\" class=\"code-anchor\">HttpClient</a></code>\nwith supporting services for JSONP.\nWithout this module, Jsonp requests reach the backend\nwith method JSONP, where they are rejected.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpClientModule\">HttpClientModule</a></code></td>\n <td>\n \n <p>Configures the <a href=\"guide/glossary#injector\">dependency injector</a> for <code><a href=\"api/common/http/HttpClient\" class=\"code-anchor\">HttpClient</a></code>\nwith supporting services for XSRF. Automatically imported by <code><a href=\"api/common/http/HttpClientModule\" class=\"code-anchor\">HttpClientModule</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpClientXsrfModule\">HttpClientXsrfModule</a></code></td>\n <td>\n \n <p>Configures XSRF protection support for outgoing requests.</p>\n\n </td>\n </tr>\n \n </tbody></table>\n </section>\n \n\n \n \n \n <section class=\"export-list\">\n <h3 id=\"classes\">Classes<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#classes\"><i class=\"material-icons\">link</i></a></h3>\n <table class=\"is-full-width list-table\">\n \n <tbody><tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpBackend\">HttpBackend</a></code></td>\n <td>\n \n <p>A final <code><a href=\"api/common/http/HttpHandler\" class=\"code-anchor\">HttpHandler</a></code> which will dispatch the request via browser HTTP APIs to a backend.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpClient\">HttpClient</a></code></td>\n <td>\n \n <p>Performs HTTP requests.\nThis service is available as an injectable class, with methods to perform HTTP requests.\nEach request method has multiple signatures, and the return type varies based on\nthe signature that is called (mainly the values of <code>observe</code> and <code>responseType</code>).</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpContext\">HttpContext</a></code></td>\n <td>\n \n <p>Http context stores arbitrary user defined values and ensures type safety without\nactually knowing the types. It is backed by a <code>Map</code> and guarantees that keys do not clash.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpContextToken\">HttpContextToken</a></code></td>\n <td>\n \n <p>A token used to manipulate and access values stored in <code><a href=\"api/common/http/HttpContext\" class=\"code-anchor\">HttpContext</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpErrorResponse\">HttpErrorResponse</a></code></td>\n <td>\n \n <p>A response that represents an error or failure, either from a\nnon-successful HTTP status, an error while executing the request,\nor some other failure which occurred during the parsing of the response.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpHandler\">HttpHandler</a></code></td>\n <td>\n \n <p>Transforms an <code><a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a></code> into a stream of <code><a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a></code>s, one of which will likely be a\n<code><a href=\"api/common/http/HttpResponse\" class=\"code-anchor\">HttpResponse</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpHeaderResponse\">HttpHeaderResponse</a></code></td>\n <td>\n \n <p>A partial HTTP response which only includes the status and header data,\nbut no response body.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpHeaders\">HttpHeaders</a></code></td>\n <td>\n \n <p>Represents the header configuration options for an HTTP request.\nInstances are immutable. Modifying methods return a cloned\ninstance with the change. The original object is never changed.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpParams\">HttpParams</a></code></td>\n <td>\n \n <p>An HTTP request/response body that represents serialized parameters,\nper the MIME type <code>application/x-www-form-urlencoded</code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpRequest\">HttpRequest</a></code></td>\n <td>\n \n <p>An outgoing HTTP request with an optional typed body.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpResponse\">HttpResponse</a></code></td>\n <td>\n \n <p>A full HTTP response, including a typed response body (which may be <code>null</code>\nif one was not returned).</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpResponseBase\">HttpResponseBase</a></code></td>\n <td>\n \n <p>Base class for both <code><a href=\"api/common/http/HttpResponse\" class=\"code-anchor\">HttpResponse</a></code> and <code><a href=\"api/common/http/HttpHeaderResponse\" class=\"code-anchor\">HttpHeaderResponse</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpUrlEncodingCodec\">HttpUrlEncodingCodec</a></code></td>\n <td>\n \n <p>Provides encoding and decoding of URL parameter and query-string values.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpXhrBackend\">HttpXhrBackend</a></code></td>\n <td>\n \n <p>Uses <code>XMLHttpRequest</code> to send requests to a backend server.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpXsrfTokenExtractor\">HttpXsrfTokenExtractor</a></code></td>\n <td>\n \n <p>Retrieves the current XSRF token to use with the next outgoing request.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/JsonpClientBackend\">JsonpClientBackend</a></code></td>\n <td>\n \n <p>Processes an <code><a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a></code> with the JSONP method,\nby performing JSONP style requests.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/JsonpInterceptor\">JsonpInterceptor</a></code></td>\n <td>\n \n <p>Identifies requests with the method JSONP and\nshifts them to the <code><a href=\"api/common/http/JsonpClientBackend\" class=\"code-anchor\">JsonpClientBackend</a></code>.</p>\n\n </td>\n </tr>\n \n </tbody></table>\n </section>\n \n\n \n \n \n\n \n \n \n\n \n \n \n <section class=\"export-list\">\n <h3 id=\"structures\">Structures<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#structures\"><i class=\"material-icons\">link</i></a></h3>\n <table class=\"is-full-width list-table\">\n \n <tbody><tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpDownloadProgressEvent\">HttpDownloadProgressEvent</a></code></td>\n <td>\n \n <p>A download progress event.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpEventType\">HttpEventType</a></code></td>\n <td>\n \n <p>Type enumeration for the different kinds of <code><a href=\"api/common/http/HttpEvent\" class=\"code-anchor\">HttpEvent</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpInterceptor\">HttpInterceptor</a></code></td>\n <td>\n \n <p>Intercepts and handles an <code><a href=\"api/common/http/HttpRequest\" class=\"code-anchor\">HttpRequest</a></code> or <code><a href=\"api/common/http/HttpResponse\" class=\"code-anchor\">HttpResponse</a></code>.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpParameterCodec\">HttpParameterCodec</a></code></td>\n <td>\n \n <p>A codec for encoding and decoding parameters in URLs.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpParamsOptions\">HttpParamsOptions</a></code></td>\n <td>\n \n <p>Options used to construct an <code><a href=\"api/common/http/HttpParams\" class=\"code-anchor\">HttpParams</a></code> instance.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpProgressEvent\">HttpProgressEvent</a></code></td>\n <td>\n \n <p>Base interface for progress events.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpSentEvent\">HttpSentEvent</a></code></td>\n <td>\n \n <p>An event indicating that the request was sent to the server. Useful\nwhen a request may be retried multiple times, to distinguish between\nretries on the final event stream.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpStatusCode\">HttpStatusCode</a></code></td>\n <td>\n \n <p>Http status codes.\nAs per <a href=\"https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\">https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml</a></p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpUploadProgressEvent\">HttpUploadProgressEvent</a></code></td>\n <td>\n \n <p>An upload progress event.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpUserEvent\">HttpUserEvent</a></code></td>\n <td>\n \n <p>A user-defined event.</p>\n\n </td>\n </tr>\n \n </tbody></table>\n </section>\n \n\n \n \n \n\n \n \n \n\n \n \n \n <section class=\"export-list\">\n <h3 id=\"types\">Types<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/http#types\"><i class=\"material-icons\">link</i></a></h3>\n <table class=\"is-full-width list-table\">\n \n <tbody><tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HTTP_INTERCEPTORS\">HTTP_INTERCEPTORS</a></code></td>\n <td>\n \n <p>A multi-provider token that represents the array of registered\n<code><a href=\"api/common/http/HttpInterceptor\" class=\"code-anchor\">HttpInterceptor</a></code> objects.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor\"><a href=\"api/common/http/HttpEvent\">HttpEvent</a></code></td>\n <td>\n \n <p>Union type for all possible events on the response stream.</p>\n\n </td>\n </tr>\n \n <tr>\n <td><code class=\"code-anchor deprecated-api-item\"><a href=\"api/common/http/XhrFactory\" class=\"deprecated-api-item\">XhrFactory</a></code></td>\n <td>\n <p><strong>Deprecated:</strong> <code><a href=\"api/common/XhrFactory\" class=\"code-anchor\">XhrFactory</a></code> has moved, please import <code><a href=\"api/common/XhrFactory\" class=\"code-anchor\">XhrFactory</a></code> from <code>@angular/common</code> instead.</p>\n\n <p>A wrapper around the <code>XMLHttpRequest</code> constructor.</p>\n\n </td>\n </tr>\n \n </tbody></table>\n </section>\n \n\n </div>\n</article>\n\n<!-- links to this doc:\n - api/common\n - api/common/http/HTTP_INTERCEPTORS\n - api/common/http/HttpBackend\n - api/common/http/HttpClient\n - api/common/http/HttpClientJsonpModule\n - api/common/http/HttpClientModule\n - api/common/http/HttpClientXsrfModule\n - api/common/http/HttpContext\n - api/common/http/HttpContextToken\n - api/common/http/HttpDownloadProgressEvent\n - api/common/http/HttpErrorResponse\n - api/common/http/HttpEvent\n - api/common/http/HttpEventType\n - api/common/http/HttpHandler\n - api/common/http/HttpHeaderResponse\n - api/common/http/HttpHeaders\n - api/common/http/HttpInterceptor\n - api/common/http/HttpParameterCodec\n - api/common/http/HttpParams\n - api/common/http/HttpParamsOptions\n - api/common/http/HttpProgressEvent\n - api/common/http/HttpRequest\n - api/common/http/HttpResponse\n - api/common/http/HttpResponseBase\n - api/common/http/HttpSentEvent\n - api/common/http/HttpStatusCode\n - api/common/http/HttpUploadProgressEvent\n - api/common/http/HttpUrlEncodingCodec\n - api/common/http/HttpUserEvent\n - api/common/http/HttpXhrBackend\n - api/common/http/HttpXsrfTokenExtractor\n - api/common/http/JsonpClientBackend\n - api/common/http/JsonpInterceptor\n - api/common/http/XhrFactory\n - api/common/upgrade/$locationShim\n - guide/deprecations\n - guide/feature-modules\n - guide/frequent-ngmodules\n - guide/http\n - guide/i18n\n - guide/npm-packages\n - guide/pipes\n - guide/schematics-for-libraries\n - guide/styleguide\n - guide/upgrade\n - start/start-data\n - tutorial/toh-pt6\n-->\n<!-- links from this doc:\n - /api\n - api/common\n - api/common/XhrFactory\n - api/common/http#angularcommonhttp\n - api/common/http#classes\n - api/common/http#entry-point-exports\n - api/common/http#ngmodules\n - api/common/http#structures\n - api/common/http#types\n - api/common/http/HTTP_INTERCEPTORS\n - api/common/http/HttpBackend\n - api/common/http/HttpClient\n - api/common/http/HttpClientJsonpModule\n - api/common/http/HttpClientModule\n - api/common/http/HttpClientXsrfModule\n - api/common/http/HttpContext\n - api/common/http/HttpContextToken\n - api/common/http/HttpDownloadProgressEvent\n - api/common/http/HttpErrorResponse\n - api/common/http/HttpEvent\n - api/common/http/HttpEventType\n - api/common/http/HttpHandler\n - api/common/http/HttpHeaderResponse\n - api/common/http/HttpHeaders\n - api/common/http/HttpInterceptor\n - api/common/http/HttpParameterCodec\n - api/common/http/HttpParams\n - api/common/http/HttpParamsOptions\n - api/common/http/HttpProgressEvent\n - api/common/http/HttpRequest\n - api/common/http/HttpResponse\n - api/common/http/HttpResponseBase\n - api/common/http/HttpSentEvent\n - api/common/http/HttpStatusCode\n - api/common/http/HttpUploadProgressEvent\n - api/common/http/HttpUrlEncodingCodec\n - api/common/http/HttpUserEvent\n - api/common/http/HttpXhrBackend\n - api/common/http/HttpXsrfTokenExtractor\n - api/common/http/JsonpClientBackend\n - api/common/http/JsonpInterceptor\n - api/common/http/XhrFactory\n - guide/glossary#injector\n - guide/http\n - https://github.com/angular/angular/edit/master/packages/common/http/PACKAGE.md?message=docs(...)%3A%20describe%20your%20change...\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/http/PACKAGE.md\n - https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\n-->"
|
|
} |