12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007 |
- /**
- * @license Angular v20.1.0
- * (c) 2010-2025 Google LLC. https://angular.io/
- * License: MIT
- */
- import * as i0 from '@angular/core';
- import { ModuleWithProviders } from '@angular/core';
- /**
- * A token used to manipulate and access values stored in `HttpContext`.
- *
- * @publicApi
- */
- declare class HttpContextToken<T> {
- readonly defaultValue: () => T;
- constructor(defaultValue: () => T);
- }
- /**
- * 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.
- *
- * This context is mutable and is shared between cloned requests unless explicitly specified.
- *
- * @usageNotes
- *
- * ### Usage Example
- *
- * ```ts
- * // inside cache.interceptors.ts
- * export const IS_CACHE_ENABLED = new HttpContextToken<boolean>(() => false);
- *
- * export class CacheInterceptor implements HttpInterceptor {
- *
- * intercept(req: HttpRequest<any>, delegate: HttpHandler): Observable<HttpEvent<any>> {
- * if (req.context.get(IS_CACHE_ENABLED) === true) {
- * return ...;
- * }
- * return delegate.handle(req);
- * }
- * }
- *
- * // inside a service
- *
- * this.httpClient.get('/api/weather', {
- * context: new HttpContext().set(IS_CACHE_ENABLED, true)
- * }).subscribe(...);
- * ```
- *
- * @publicApi
- */
- declare class HttpContext {
- private readonly map;
- /**
- * Store a value in the context. If a value is already present it will be overwritten.
- *
- * @param token The reference to an instance of `HttpContextToken`.
- * @param value The value to store.
- *
- * @returns A reference to itself for easy chaining.
- */
- set<T>(token: HttpContextToken<T>, value: T): HttpContext;
- /**
- * Retrieve the value associated with the given token.
- *
- * @param token The reference to an instance of `HttpContextToken`.
- *
- * @returns The stored value or default if one is defined.
- */
- get<T>(token: HttpContextToken<T>): T;
- /**
- * Delete the value associated with the given token.
- *
- * @param token The reference to an instance of `HttpContextToken`.
- *
- * @returns A reference to itself for easy chaining.
- */
- delete(token: HttpContextToken<unknown>): HttpContext;
- /**
- * Checks for existence of a given token.
- *
- * @param token The reference to an instance of `HttpContextToken`.
- *
- * @returns True if the token exists, false otherwise.
- */
- has(token: HttpContextToken<unknown>): boolean;
- /**
- * @returns a list of tokens currently stored in the context.
- */
- keys(): IterableIterator<HttpContextToken<unknown>>;
- }
- /**
- * 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.
- *
- * @publicApi
- */
- declare class HttpHeaders {
- /**
- * Internal map of lowercase header names to values.
- */
- private headers;
- /**
- * Internal map of lowercased header names to the normalized
- * form of the name (the form seen first).
- */
- private normalizedNames;
- /**
- * Complete the lazy initialization of this object (needed before reading).
- */
- private lazyInit;
- /**
- * Queued updates to be materialized the next initialization.
- */
- private lazyUpdate;
- /** Constructs a new HTTP header object with the given values.*/
- constructor(headers?: string | {
- [name: string]: string | number | (string | number)[];
- } | Headers);
- /**
- * Checks for existence of a given header.
- *
- * @param name The header name to check for existence.
- *
- * @returns True if the header exists, false otherwise.
- */
- has(name: string): boolean;
- /**
- * Retrieves the first value of a given header.
- *
- * @param name The header name.
- *
- * @returns The value string if the header exists, null otherwise
- */
- get(name: string): string | null;
- /**
- * Retrieves the names of the headers.
- *
- * @returns A list of header names.
- */
- keys(): string[];
- /**
- * Retrieves a list of values for a given header.
- *
- * @param name The header name from which to retrieve values.
- *
- * @returns A string of values if the header exists, null otherwise.
- */
- getAll(name: string): string[] | null;
- /**
- * Appends a new value to the existing set of values for a header
- * and returns them in a clone of the original instance.
- *
- * @param name The header name for which to append the values.
- * @param value The value to append.
- *
- * @returns A clone of the HTTP headers object with the value appended to the given header.
- */
- append(name: string, value: string | string[]): HttpHeaders;
- /**
- * Sets or modifies a value for a given header in a clone of the original instance.
- * If the header already exists, its value is replaced with the given value
- * in the returned object.
- *
- * @param name The header name.
- * @param value The value or values to set or override for the given header.
- *
- * @returns A clone of the HTTP headers object with the newly set header value.
- */
- set(name: string, value: string | string[]): HttpHeaders;
- /**
- * Deletes values for a given header in a clone of the original instance.
- *
- * @param name The header name.
- * @param value The value or values to delete for the given header.
- *
- * @returns A clone of the HTTP headers object with the given value deleted.
- */
- delete(name: string, value?: string | string[]): HttpHeaders;
- private maybeSetNormalizedName;
- private init;
- private copyFrom;
- private clone;
- private applyUpdate;
- private addHeaderEntry;
- private setHeaderEntries;
- }
- /**
- * A codec for encoding and decoding parameters in URLs.
- *
- * Used by `HttpParams`.
- *
- * @publicApi
- **/
- interface HttpParameterCodec {
- encodeKey(key: string): string;
- encodeValue(value: string): string;
- decodeKey(key: string): string;
- decodeValue(value: string): string;
- }
- /**
- * Provides encoding and decoding of URL parameter and query-string values.
- *
- * Serializes and parses URL parameter keys and values to encode and decode them.
- * If you pass URL query parameters without encoding,
- * the query parameters can be misinterpreted at the receiving end.
- *
- *
- * @publicApi
- */
- declare class HttpUrlEncodingCodec implements HttpParameterCodec {
- /**
- * Encodes a key name for a URL parameter or query-string.
- * @param key The key name.
- * @returns The encoded key name.
- */
- encodeKey(key: string): string;
- /**
- * Encodes the value of a URL parameter or query-string.
- * @param value The value.
- * @returns The encoded value.
- */
- encodeValue(value: string): string;
- /**
- * Decodes an encoded URL parameter or query-string key.
- * @param key The encoded key name.
- * @returns The decoded key name.
- */
- decodeKey(key: string): string;
- /**
- * Decodes an encoded URL parameter or query-string value.
- * @param value The encoded value.
- * @returns The decoded value.
- */
- decodeValue(value: string): string;
- }
- /**
- * Options used to construct an `HttpParams` instance.
- *
- * @publicApi
- */
- interface HttpParamsOptions {
- /**
- * String representation of the HTTP parameters in URL-query-string format.
- * Mutually exclusive with `fromObject`.
- */
- fromString?: string;
- /** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */
- fromObject?: {
- [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
- };
- /** Encoding codec used to parse and serialize the parameters. */
- encoder?: HttpParameterCodec;
- }
- /**
- * An HTTP request/response body that represents serialized parameters,
- * per the MIME type `application/x-www-form-urlencoded`.
- *
- * This class is immutable; all mutation operations return a new instance.
- *
- * @publicApi
- */
- declare class HttpParams {
- private map;
- private encoder;
- private updates;
- private cloneFrom;
- constructor(options?: HttpParamsOptions);
- /**
- * Reports whether the body includes one or more values for a given parameter.
- * @param param The parameter name.
- * @returns True if the parameter has one or more values,
- * false if it has no value or is not present.
- */
- has(param: string): boolean;
- /**
- * Retrieves the first value for a parameter.
- * @param param The parameter name.
- * @returns The first value of the given parameter,
- * or `null` if the parameter is not present.
- */
- get(param: string): string | null;
- /**
- * Retrieves all values for a parameter.
- * @param param The parameter name.
- * @returns All values in a string array,
- * or `null` if the parameter not present.
- */
- getAll(param: string): string[] | null;
- /**
- * Retrieves all the parameters for this body.
- * @returns The parameter names in a string array.
- */
- keys(): string[];
- /**
- * Appends a new value to existing values for a parameter.
- * @param param The parameter name.
- * @param value The new value to add.
- * @return A new body with the appended value.
- */
- append(param: string, value: string | number | boolean): HttpParams;
- /**
- * Constructs a new body with appended values for the given parameter name.
- * @param params parameters and values
- * @return A new body with the new value.
- */
- appendAll(params: {
- [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
- }): HttpParams;
- /**
- * Replaces the value for a parameter.
- * @param param The parameter name.
- * @param value The new value.
- * @return A new body with the new value.
- */
- set(param: string, value: string | number | boolean): HttpParams;
- /**
- * Removes a given value or all values from a parameter.
- * @param param The parameter name.
- * @param value The value to remove, if provided.
- * @return A new body with the given value removed, or with all values
- * removed if no value is specified.
- */
- delete(param: string, value?: string | number | boolean): HttpParams;
- /**
- * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
- * separated by `&`s.
- */
- toString(): string;
- private clone;
- private init;
- }
- /**
- * An outgoing HTTP request with an optional typed body.
- *
- * `HttpRequest` represents an outgoing request, including URL, method,
- * headers, body, and other request configuration options. Instances should be
- * assumed to be immutable. To modify a `HttpRequest`, the `clone`
- * method should be used.
- *
- * @publicApi
- */
- declare class HttpRequest<T> {
- readonly url: string;
- /**
- * The request body, or `null` if one isn't set.
- *
- * Bodies are not enforced to be immutable, as they can include a reference to any
- * user-defined data type. However, interceptors should take care to preserve
- * idempotence by treating them as such.
- */
- readonly body: T | null;
- /**
- * Outgoing headers for this request.
- */
- readonly headers: HttpHeaders;
- /**
- * Shared and mutable context that can be used by interceptors
- */
- readonly context: HttpContext;
- /**
- * Whether this request should be made in a way that exposes progress events.
- *
- * Progress events are expensive (change detection runs on each event) and so
- * they should only be requested if the consumer intends to monitor them.
- *
- * Note: The `FetchBackend` doesn't support progress report on uploads.
- */
- readonly reportProgress: boolean;
- /**
- * Whether this request should be sent with outgoing credentials (cookies).
- */
- readonly withCredentials: boolean;
- /**
- * The credentials mode of the request, which determines how cookies and HTTP authentication are handled.
- * This can affect whether cookies are sent with the request, and how authentication is handled.
- */
- readonly credentials: RequestCredentials;
- /**
- * When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
- */
- readonly keepalive: boolean;
- /**
- * Controls how the request will interact with the browser's HTTP cache.
- * This affects whether a response is retrieved from the cache, how it is stored, or if it bypasses the cache altogether.
- */
- readonly cache: RequestCache;
- /**
- * Indicates the relative priority of the request. This may be used by the browser to decide the order in which requests are dispatched and resources fetched.
- */
- readonly priority: RequestPriority;
- /**
- * The mode of the request, which determines how the request will interact with the browser's security model.
- * This can affect things like CORS (Cross-Origin Resource Sharing) and same-origin policies.
- */
- readonly mode: RequestMode;
- /**
- * The redirect mode of the request, which determines how redirects are handled.
- * This can affect whether the request follows redirects automatically, or if it fails when a redirect occurs.
- */
- readonly redirect: RequestRedirect;
- /**
- * The expected response type of the server.
- *
- * This is used to parse the response appropriately before returning it to
- * the requestee.
- */
- readonly responseType: 'arraybuffer' | 'blob' | 'json' | 'text';
- /**
- * The outgoing HTTP request method.
- */
- readonly method: string;
- /**
- * Outgoing URL parameters.
- *
- * To pass a string representation of HTTP parameters in the URL-query-string format,
- * the `HttpParamsOptions`' `fromString` may be used. For example:
- *
- * ```ts
- * new HttpParams({fromString: 'angular=awesome'})
- * ```
- */
- readonly params: HttpParams;
- /**
- * The outgoing URL with all URL parameters set.
- */
- readonly urlWithParams: string;
- /**
- * The HttpTransferCache option for the request
- */
- readonly transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- /**
- * The timeout for the backend HTTP request in ms.
- */
- readonly timeout?: number;
- constructor(method: 'GET' | 'HEAD', url: string, init?: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- /**
- * This property accepts either a boolean to enable/disable transferring cache for eligible
- * requests performed using `HttpClient`, or an object, which allows to configure cache
- * parameters, such as which headers should be included (no headers are included by default).
- *
- * Setting this property will override the options passed to `provideClientHydration()` for this
- * particular request
- */
- transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- timeout?: number;
- });
- constructor(method: 'DELETE' | 'JSONP' | 'OPTIONS', url: string, init?: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- timeout?: number;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- });
- constructor(method: 'POST', url: string, body: T | null, init?: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- /**
- * This property accepts either a boolean to enable/disable transferring cache for eligible
- * requests performed using `HttpClient`, or an object, which allows to configure cache
- * parameters, such as which headers should be included (no headers are included by default).
- *
- * Setting this property will override the options passed to `provideClientHydration()` for this
- * particular request
- */
- transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- timeout?: number;
- });
- constructor(method: 'PUT' | 'PATCH', url: string, body: T | null, init?: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- timeout?: number;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- });
- constructor(method: string, url: string, body: T | null, init?: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- /**
- * This property accepts either a boolean to enable/disable transferring cache for eligible
- * requests performed using `HttpClient`, or an object, which allows to configure cache
- * parameters, such as which headers should be included (no headers are included by default).
- *
- * Setting this property will override the options passed to `provideClientHydration()` for this
- * particular request
- */
- transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- timeout?: number;
- });
- /**
- * Transform the free-form body into a serialized format suitable for
- * transmission to the server.
- */
- serializeBody(): ArrayBuffer | Blob | FormData | URLSearchParams | string | null;
- /**
- * Examine the body and attempt to infer an appropriate MIME type
- * for it.
- *
- * If no such type can be inferred, this method will return `null`.
- */
- detectContentTypeHeader(): string | null;
- clone(): HttpRequest<T>;
- clone(update: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- timeout?: number;
- body?: T | null;
- method?: string;
- url?: string;
- setHeaders?: {
- [name: string]: string | string[];
- };
- setParams?: {
- [param: string]: string;
- };
- }): HttpRequest<T>;
- clone<V>(update: {
- headers?: HttpHeaders;
- context?: HttpContext;
- reportProgress?: boolean;
- params?: HttpParams;
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
- keepalive?: boolean;
- priority?: RequestPriority;
- cache?: RequestCache;
- mode?: RequestMode;
- redirect?: RequestRedirect;
- withCredentials?: boolean;
- credentials?: RequestCredentials;
- transferCache?: {
- includeHeaders?: string[];
- } | boolean;
- timeout?: number;
- body?: V | null;
- method?: string;
- url?: string;
- setHeaders?: {
- [name: string]: string | string[];
- };
- setParams?: {
- [param: string]: string;
- };
- }): HttpRequest<V>;
- }
- /**
- * Type enumeration for the different kinds of `HttpEvent`.
- *
- * @publicApi
- */
- declare enum HttpEventType {
- /**
- * The request was sent out over the wire.
- */
- Sent = 0,
- /**
- * An upload progress event was received.
- *
- * Note: The `FetchBackend` doesn't support progress report on uploads.
- */
- UploadProgress = 1,
- /**
- * The response status code and headers were received.
- */
- ResponseHeader = 2,
- /**
- * A download progress event was received.
- */
- DownloadProgress = 3,
- /**
- * The full response including the body was received.
- */
- Response = 4,
- /**
- * A custom event from an interceptor or a backend.
- */
- User = 5
- }
- /**
- * Base interface for progress events.
- *
- * @publicApi
- */
- interface HttpProgressEvent {
- /**
- * Progress event type is either upload or download.
- */
- type: HttpEventType.DownloadProgress | HttpEventType.UploadProgress;
- /**
- * Number of bytes uploaded or downloaded.
- */
- loaded: number;
- /**
- * Total number of bytes to upload or download. Depending on the request or
- * response, this may not be computable and thus may not be present.
- */
- total?: number;
- }
- /**
- * A download progress event.
- *
- * @publicApi
- */
- interface HttpDownloadProgressEvent extends HttpProgressEvent {
- type: HttpEventType.DownloadProgress;
- /**
- * The partial response body as downloaded so far.
- *
- * Only present if the responseType was `text`.
- */
- partialText?: string;
- }
- /**
- * An upload progress event.
- *
- * Note: The `FetchBackend` doesn't support progress report on uploads.
- *
- * @publicApi
- */
- interface HttpUploadProgressEvent extends HttpProgressEvent {
- type: HttpEventType.UploadProgress;
- }
- /**
- * 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.
- *
- * @publicApi
- */
- interface HttpSentEvent {
- type: HttpEventType.Sent;
- }
- /**
- * A user-defined event.
- *
- * Grouping all custom events under this type ensures they will be handled
- * and forwarded by all implementations of interceptors.
- *
- * @publicApi
- */
- interface HttpUserEvent<T> {
- type: HttpEventType.User;
- }
- /**
- * Union type for all possible events on the response stream.
- *
- * Typed according to the expected type of the response.
- *
- * @publicApi
- */
- type HttpEvent<T> = HttpSentEvent | HttpHeaderResponse | HttpResponse<T> | HttpProgressEvent | HttpUserEvent<T>;
- /**
- * Base class for both `HttpResponse` and `HttpHeaderResponse`.
- *
- * @publicApi
- */
- declare abstract class HttpResponseBase {
- /**
- * All response headers.
- */
- readonly headers: HttpHeaders;
- /**
- * Response status code.
- */
- readonly status: number;
- /**
- * Textual description of response status code, defaults to OK.
- *
- * Do not depend on this.
- */
- readonly statusText: string;
- /**
- * URL of the resource retrieved, or null if not available.
- */
- readonly url: string | null;
- /**
- * Whether the status code falls in the 2xx range.
- */
- readonly ok: boolean;
- /**
- * Type of the response, narrowed to either the full response or the header.
- */
- readonly type: HttpEventType.Response | HttpEventType.ResponseHeader;
- /**
- * Super-constructor for all responses.
- *
- * The single parameter accepted is an initialization hash. Any properties
- * of the response passed there will override the default values.
- */
- constructor(init: {
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- }, defaultStatus?: number, defaultStatusText?: string);
- }
- /**
- * A partial HTTP response which only includes the status and header data,
- * but no response body.
- *
- * `HttpHeaderResponse` is a `HttpEvent` available on the response
- * event stream, only when progress events are requested.
- *
- * @publicApi
- */
- declare class HttpHeaderResponse extends HttpResponseBase {
- /**
- * Create a new `HttpHeaderResponse` with the given parameters.
- */
- constructor(init?: {
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- });
- readonly type: HttpEventType.ResponseHeader;
- /**
- * Copy this `HttpHeaderResponse`, overriding its contents with the
- * given parameter hash.
- */
- clone(update?: {
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- }): HttpHeaderResponse;
- }
- /**
- * 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.
- *
- * @publicApi
- */
- declare class HttpResponse<T> extends HttpResponseBase {
- /**
- * The response body, or `null` if one was not returned.
- */
- readonly body: T | null;
- /**
- * Construct a new `HttpResponse`.
- */
- constructor(init?: {
- body?: T | null;
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- });
- readonly type: HttpEventType.Response;
- clone(): HttpResponse<T>;
- clone(update: {
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- }): HttpResponse<T>;
- clone<V>(update: {
- body?: V | null;
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- }): HttpResponse<V>;
- }
- /**
- * 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.
- *
- * Any error returned on the `Observable` response stream will be
- * wrapped in an `HttpErrorResponse` to provide additional context about
- * the state of the HTTP layer when the error occurred. The error property
- * will contain either a wrapped Error object or the error response returned
- * from the server.
- *
- * @publicApi
- */
- declare class HttpErrorResponse extends HttpResponseBase implements Error {
- readonly name = "HttpErrorResponse";
- readonly message: string;
- readonly error: any | null;
- /**
- * Errors are never okay, even when the status code is in the 2xx success range.
- */
- readonly ok = false;
- constructor(init: {
- error?: any;
- headers?: HttpHeaders;
- status?: number;
- statusText?: string;
- url?: string;
- });
- }
- /**
- * Http status codes.
- * As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
- * @publicApi
- */
- declare enum HttpStatusCode {
- Continue = 100,
- SwitchingProtocols = 101,
- Processing = 102,
- EarlyHints = 103,
- Ok = 200,
- Created = 201,
- Accepted = 202,
- NonAuthoritativeInformation = 203,
- NoContent = 204,
- ResetContent = 205,
- PartialContent = 206,
- MultiStatus = 207,
- AlreadyReported = 208,
- ImUsed = 226,
- MultipleChoices = 300,
- MovedPermanently = 301,
- Found = 302,
- SeeOther = 303,
- NotModified = 304,
- UseProxy = 305,
- Unused = 306,
- TemporaryRedirect = 307,
- PermanentRedirect = 308,
- BadRequest = 400,
- Unauthorized = 401,
- PaymentRequired = 402,
- Forbidden = 403,
- NotFound = 404,
- MethodNotAllowed = 405,
- NotAcceptable = 406,
- ProxyAuthenticationRequired = 407,
- RequestTimeout = 408,
- Conflict = 409,
- Gone = 410,
- LengthRequired = 411,
- PreconditionFailed = 412,
- PayloadTooLarge = 413,
- UriTooLong = 414,
- UnsupportedMediaType = 415,
- RangeNotSatisfiable = 416,
- ExpectationFailed = 417,
- ImATeapot = 418,
- MisdirectedRequest = 421,
- UnprocessableEntity = 422,
- Locked = 423,
- FailedDependency = 424,
- TooEarly = 425,
- UpgradeRequired = 426,
- PreconditionRequired = 428,
- TooManyRequests = 429,
- RequestHeaderFieldsTooLarge = 431,
- UnavailableForLegalReasons = 451,
- InternalServerError = 500,
- NotImplemented = 501,
- BadGateway = 502,
- ServiceUnavailable = 503,
- GatewayTimeout = 504,
- HttpVersionNotSupported = 505,
- VariantAlsoNegotiates = 506,
- InsufficientStorage = 507,
- LoopDetected = 508,
- NotExtended = 510,
- NetworkAuthenticationRequired = 511
- }
- /**
- * Configures XSRF protection support for outgoing requests.
- *
- * For a server that supports a cookie-based XSRF protection system,
- * use directly to configure XSRF protection with the correct
- * cookie and header names.
- *
- * If no names are supplied, the default cookie name is `XSRF-TOKEN`
- * and the default header name is `X-XSRF-TOKEN`.
- *
- * @publicApi
- * @deprecated Use withXsrfConfiguration({cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN'}) as
- * providers instead or `withNoXsrfProtection` if you want to disabled XSRF protection.
- */
- declare class HttpClientXsrfModule {
- /**
- * Disable the default XSRF protection.
- */
- static disable(): ModuleWithProviders<HttpClientXsrfModule>;
- /**
- * Configure XSRF protection.
- * @param options An object that can specify either or both
- * cookie name or header name.
- * - Cookie name default is `XSRF-TOKEN`.
- * - Header name default is `X-XSRF-TOKEN`.
- *
- */
- static withOptions(options?: {
- cookieName?: string;
- headerName?: string;
- }): ModuleWithProviders<HttpClientXsrfModule>;
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientXsrfModule, never>;
- static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientXsrfModule, never, never, never>;
- static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientXsrfModule>;
- }
- /**
- * Configures the dependency injector for `HttpClient`
- * with supporting services for XSRF. Automatically imported by `HttpClientModule`.
- *
- * You can add interceptors to the chain behind `HttpClient` by binding them to the
- * multiprovider for built-in DI token `HTTP_INTERCEPTORS`.
- *
- * @publicApi
- * @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
- */
- declare class HttpClientModule {
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientModule, never>;
- static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientModule, never, never, never>;
- static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientModule>;
- }
- /**
- * 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.
- *
- * @publicApi
- * @deprecated `withJsonpSupport()` as providers instead
- */
- declare class HttpClientJsonpModule {
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpClientJsonpModule, never>;
- static ɵmod: i0.ɵɵNgModuleDeclaration<HttpClientJsonpModule, never, never, never>;
- static ɵinj: i0.ɵɵInjectorDeclaration<HttpClientJsonpModule>;
- }
- export { HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpStatusCode, HttpUrlEncodingCodec };
- export type { HttpDownloadProgressEvent, HttpEvent, HttpParameterCodec, HttpParamsOptions, HttpProgressEvent, HttpSentEvent, HttpUploadProgressEvent, HttpUserEvent };
|