UNPKG

@angular/common

Version:

Angular - commonly needed directives and services

1,252 lines (1,249 loc) • 135 kB
/** * @license Angular v19.2.12 * (c) 2010-2025 Google LLC. https://angular.io/ * License: MIT */ import { Observable } from 'rxjs'; import { HttpRequest, HttpEvent, HttpHeaders, HttpContext, HttpParams, HttpResponse, HttpProgressEvent } from '../module.d-CnjH8Dlt.js'; export { HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContextToken, HttpDownloadProgressEvent, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpParameterCodec, HttpParamsOptions, HttpResponseBase, HttpSentEvent, HttpStatusCode, HttpUploadProgressEvent, HttpUrlEncodingCodec, HttpUserEvent } from '../module.d-CnjH8Dlt.js'; import * as i0 from '@angular/core'; import { InjectionToken, EnvironmentInjector, Provider, EnvironmentProviders, WritableResource, ResourceRef, Signal, Injector, ValueEqualityFn } from '@angular/core'; import { XhrFactory } from '../xhr.d-D_1kTQR5.js'; /** * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a * `HttpResponse`. * * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the * `HttpBackend`. * * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain. * * @publicApi */ declare abstract class HttpHandler { abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>; } /** * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend. * * Interceptors sit between the `HttpClient` interface and the `HttpBackend`. * * When injected, `HttpBackend` dispatches requests directly to the backend, without going * through the interceptor chain. * * @publicApi */ declare abstract class HttpBackend implements HttpHandler { abstract handle(req: HttpRequest<any>): Observable<HttpEvent<any>>; } /** * 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`). * * Note that the `responseType` *options* value is a String that identifies the * single data type of the response. * A single overload version of the method handles each response type. * The value of `responseType` cannot be a union, as the combined signature could imply. * * @usageNotes * * ### HTTP Request Example * * ```ts * // GET heroes whose name contains search term * searchHeroes(term: string): observable<Hero[]>{ * * const params = new HttpParams({fromString: 'name=term'}); * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params}); * } * ``` * * Alternatively, the parameter string can be used without invoking HttpParams * by directly joining to the URL. * ```ts * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'}); * ``` * * * ### JSONP Example * ```ts * requestJsonp(url, callback = 'callback') { * return this.httpClient.jsonp(this.heroesURL, callback); * } * ``` * * ### PATCH Example * ```ts * // PATCH one of the heroes' name * patchHero (id: number, heroName: string): Observable<{}> { * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42 * return this.httpClient.patch(url, {name: heroName}, httpOptions) * .pipe(catchError(this.handleError('patchHero'))); * } * ``` * * @see [HTTP Guide](guide/http) * @see [HTTP Request](api/common/http/HttpRequest) * * @publicApi */ declare class HttpClient { private handler; constructor(handler: HttpHandler); /** * Sends an `HttpRequest` and returns a stream of `HttpEvent`s. * * @return An `Observable` of the response, with the response body as a stream of `HttpEvent`s. */ request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>; /** * Constructs a request that interprets the body as an `ArrayBuffer` and returns the response in * an `ArrayBuffer`. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * * @return An `Observable` of the response, with the response body as an `ArrayBuffer`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<ArrayBuffer>; /** * Constructs a request that interprets the body as a blob and returns * the response as a blob. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type `Blob`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<Blob>; /** * Constructs a request that interprets the body as a text string and * returns a string value. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type string. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<string>; /** * Constructs a request that interprets the body as an `ArrayBuffer` and returns the * the full event stream. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as an array of `HttpEvent`s for * the request. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; observe: 'events'; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<ArrayBuffer>>; /** * Constructs a request that interprets the body as a `Blob` and returns * the full event stream. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body of type `Blob`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<Blob>>; /** * Constructs a request which interprets the body as a text string and returns the full event * stream. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body of type string. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<string>>; /** * Constructs a request which interprets the body as a JavaScript object and returns the full * event stream. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body of type `Object`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; reportProgress?: boolean; observe: 'events'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<any>>; /** * Constructs a request which interprets the body as a JavaScript object and returns the full * event stream. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body of type `R`. */ request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; reportProgress?: boolean; observe: 'events'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<R>>; /** * Constructs a request which interprets the body as an `ArrayBuffer` * and returns the full `HttpResponse`. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body as an `ArrayBuffer`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<ArrayBuffer>>; /** * Constructs a request which interprets the body as a `Blob` and returns the full `HttpResponse`. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<Blob>>; /** * Constructs a request which interprets the body as a text stream and returns the full * `HttpResponse`. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the HTTP response, with the response body of type string. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<string>>; /** * Constructs a request which interprets the body as a JavaScript object and returns the full * `HttpResponse`. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse`, * with the response body of type `Object`. */ request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; reportProgress?: boolean; observe: 'response'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; withCredentials?: boolean; }): Observable<HttpResponse<Object>>; /** * Constructs a request which interprets the body as a JavaScript object and returns * the full `HttpResponse` with the response body in the requested type. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse`, with the response body of type `R`. */ request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; reportProgress?: boolean; observe: 'response'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<R>>; /** * Constructs a request which interprets the body as a JavaScript object and returns the full * `HttpResponse` as a JavaScript object. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`. */ request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; reportProgress?: boolean; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<Object>; /** * Constructs a request which interprets the body as a JavaScript object * with the response body of the requested type. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of type `R`. */ request<R>(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; responseType?: 'json'; reportProgress?: boolean; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<R>; /** * Constructs a request where response type and requested observable are not known statically. * * @param method The HTTP method. * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the requested response, with body of type `any`. */ request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<any>; /** * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` * and returns the response as an `ArrayBuffer`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response body as an `ArrayBuffer`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; body?: any | null; }): Observable<ArrayBuffer>; /** * Constructs a `DELETE` request that interprets the body as a `Blob` and returns * the response as a `Blob`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response body as a `Blob`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; body?: any | null; }): Observable<Blob>; /** * Constructs a `DELETE` request that interprets the body as a text string and returns * a string. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type string. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; body?: any | null; }): Observable<string>; /** * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with response body as an `ArrayBuffer`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; body?: any | null; }): Observable<HttpEvent<ArrayBuffer>>; /** * Constructs a `DELETE` request that interprets the body as a `Blob` * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all the `HttpEvent`s for the request, with the response body as a * `Blob`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; body?: any | null; }): Observable<HttpEvent<Blob>>; /** * Constructs a `DELETE` request that interprets the body as a text string * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, with the response * body of type string. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; body?: any | null; }): Observable<HttpEvent<string>>; /** * Constructs a `DELETE` request that interprets the body as JSON * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, with response body of * type `Object`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<HttpEvent<Object>>; /** * Constructs a `DELETE`request that interprets the body as JSON * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all the `HttpEvent`s for the request, with a response * body in the requested type. */ delete<T>(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | (string | number | boolean)[]>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<HttpEvent<T>>; /** * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` and returns * the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse`, with the response body as an `ArrayBuffer`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; body?: any | null; }): Observable<HttpResponse<ArrayBuffer>>; /** * Constructs a `DELETE` request that interprets the body as a `Blob` and returns the full * `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; body?: any | null; }): Observable<HttpResponse<Blob>>; /** * Constructs a `DELETE` request that interprets the body as a text stream and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse`, with the response body of type string. */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; body?: any | null; }): Observable<HttpResponse<string>>; /** * Constructs a `DELETE` request the interprets the body as a JavaScript object and returns * the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`. * */ delete(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<HttpResponse<Object>>; /** * Constructs a `DELETE` request that interprets the body as JSON * and returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with the response body of the requested type. */ delete<T>(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<HttpResponse<T>>; /** * Constructs a `DELETE` request that interprets the body as JSON and * returns the response body as an object parsed from JSON. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type `Object`. */ delete(url: string, options?: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<Object>; /** * Constructs a DELETE request that interprets the body as JSON and returns * the response in a given type. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with response body in the requested type. */ delete<T>(url: string, options?: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; body?: any | null; }): Observable<T>; /** * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns the * response in an `ArrayBuffer`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as an `ArrayBuffer`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<ArrayBuffer>; /** * Constructs a `GET` request that interprets the body as a `Blob` * and returns the response as a `Blob`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as a `Blob`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<Blob>; /** * Constructs a `GET` request that interprets the body as a text string * and returns the response as a string value. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type string. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<string>; /** * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns * the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, with the response * body as an `ArrayBuffer`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<ArrayBuffer>>; /** * Constructs a `GET` request that interprets the body as a `Blob` and * returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as a `Blob`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<Blob>>; /** * Constructs a `GET` request that interprets the body as a text string and returns * the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type string. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<string>>; /** * Constructs a `GET` request that interprets the body as JSON * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type `Object`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<Object>>; /** * Constructs a `GET` request that interprets the body as JSON and returns the full * event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with a response body in the requested type. */ get<T>(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<T>>; /** * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse` for the request, * with the response body as an `ArrayBuffer`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<ArrayBuffer>>; /** * Constructs a `GET` request that interprets the body as a `Blob` and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse` for the request, * with the response body as a `Blob`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<Blob>>; /** * Constructs a `GET` request that interprets the body as a text stream and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse` for the request, * with the response body of type string. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<string>>; /** * Constructs a `GET` request that interprets the body as JSON and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse`, * with the response body of type `Object`. */ get(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<Object>>; /** * Constructs a `GET` request that interprets the body as JSON and * returns the full `HttpResponse`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the full `HttpResponse` for the request, * with a response body in the requested type. */ get<T>(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'response'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpResponse<T>>; /** * Constructs a `GET` request that interprets the body as JSON and * returns the response body as an object parsed from JSON. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * * @return An `Observable` of the response body as a JavaScript object. */ get(url: string, options?: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<Object>; /** * Constructs a `GET` request that interprets the body as JSON and returns * the response body in a given type. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the `HttpResponse`, with a response body in the requested type. */ get<T>(url: string, options?: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<T>; /** * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer` and * returns the response as an `ArrayBuffer`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as an `ArrayBuffer`. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<ArrayBuffer>; /** * Constructs a `HEAD` request that interprets the body as a `Blob` and returns * the response as a `Blob`. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body as a `Blob`. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<Blob>; /** * Constructs a `HEAD` request that interprets the body as a text string and returns the response * as a string value. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of the response, with the response body of type string. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; context?: HttpContext; observe?: 'body'; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<string>; /** * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer` * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body as an `ArrayBuffer`. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'arraybuffer'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<ArrayBuffer>>; /** * Constructs a `HEAD` request that interprets the body as a `Blob` and * returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, * with the response body as a `Blob`. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'blob'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<Blob>>; /** * Constructs a `HEAD` request that interprets the body as a text string * and returns the full event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, with the response body of type * string. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType: 'text'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<string>>; /** * Constructs a `HEAD` request that interprets the body as JSON * and returns the full HTTP event stream. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. * * @return An `Observable` of all `HttpEvent`s for the request, with a response body of * type `Object`. */ head(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; context?: HttpContext; params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>; reportProgress?: boolean; responseType?: 'json'; withCredentials?: boolean; transferCache?: { includeHeaders?: string[]; } | boolean; }): Observable<HttpEvent<Object>>; /** * Constructs a `HEAD` request that interprets the body as JSON and * returns the full event stream. * * @return An `Observable` of all the `HttpEvent`s for the request, * with a response body in the requested type. * * @param url The endpoint URL. * @param options The HTTP options to send with the request. */ head<T>(url: string, options: { headers?: HttpHeaders | Record<string, string | string[]>; observe: 'events'; con