{"version":3,"file":"http.mjs","sources":["../../../../../../packages/common/http/src/backend.ts","../../../../../../packages/common/http/src/headers.ts","../../../../../../packages/common/http/src/params.ts","../../../../../../packages/common/http/src/context.ts","../../../../../../packages/common/http/src/request.ts","../../../../../../packages/common/http/src/response.ts","../../../../../../packages/common/http/src/client.ts","../../../../../../packages/common/http/src/fetch.ts","../../../../../../packages/common/http/src/interceptor.ts","../../../../../../packages/common/http/src/jsonp.ts","../../../../../../packages/common/http/src/xhr.ts","../../../../../../packages/common/http/src/xsrf.ts","../../../../../../packages/common/http/src/provider.ts","../../../../../../packages/common/http/src/module.ts","../../../../../../packages/common/http/src/transfer_cache.ts","../../../../../../packages/common/http/index.ts","../../../../../../packages/common/http/http.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Observable} from 'rxjs';\n\nimport {HttpRequest} from './request';\nimport {HttpEvent} from './response';\n\n/**\n * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a\n * `HttpResponse`.\n *\n * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the\n * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the\n * `HttpBackend`.\n *\n * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.\n *\n * @publicApi\n */\nexport abstract class HttpHandler {\n abstract handle(req: HttpRequest): Observable>;\n}\n\n/**\n * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.\n *\n * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.\n *\n * When injected, `HttpBackend` dispatches requests directly to the backend, without going\n * through the interceptor chain.\n *\n * @publicApi\n */\nexport abstract class HttpBackend implements HttpHandler {\n abstract handle(req: HttpRequest): Observable>;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\ninterface Update {\n name: string;\n value?: string | string[];\n op: 'a' | 's' | 'd';\n}\n\n/**\n * Represents the header configuration options for an HTTP request.\n * Instances are immutable. Modifying methods return a cloned\n * instance with the change. The original object is never changed.\n *\n * @publicApi\n */\nexport class HttpHeaders {\n /**\n * Internal map of lowercase header names to values.\n */\n // TODO(issue/24571): remove '!'.\n private headers!: Map;\n\n /**\n * Internal map of lowercased header names to the normalized\n * form of the name (the form seen first).\n */\n private normalizedNames: Map = new Map();\n\n /**\n * Complete the lazy initialization of this object (needed before reading).\n */\n private lazyInit!: HttpHeaders | Function | null;\n\n /**\n * Queued updates to be materialized the next initialization.\n */\n private lazyUpdate: Update[] | null = null;\n\n /** Constructs a new HTTP header object with the given values.*/\n\n constructor(\n headers?: string | {[name: string]: string | number | (string | number)[]} | Headers,\n ) {\n if (!headers) {\n this.headers = new Map();\n } else if (typeof headers === 'string') {\n this.lazyInit = () => {\n this.headers = new Map();\n headers.split('\\n').forEach((line) => {\n const index = line.indexOf(':');\n if (index > 0) {\n const name = line.slice(0, index);\n const key = name.toLowerCase();\n const value = line.slice(index + 1).trim();\n this.maybeSetNormalizedName(name, key);\n if (this.headers.has(key)) {\n this.headers.get(key)!.push(value);\n } else {\n this.headers.set(key, [value]);\n }\n }\n });\n };\n } else if (typeof Headers !== 'undefined' && headers instanceof Headers) {\n this.headers = new Map();\n headers.forEach((values: string, name: string) => {\n this.setHeaderEntries(name, values);\n });\n } else {\n this.lazyInit = () => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n assertValidHeaders(headers);\n }\n this.headers = new Map();\n Object.entries(headers).forEach(([name, values]) => {\n this.setHeaderEntries(name, values);\n });\n };\n }\n }\n\n /**\n * Checks for existence of a given header.\n *\n * @param name The header name to check for existence.\n *\n * @returns True if the header exists, false otherwise.\n */\n has(name: string): boolean {\n this.init();\n\n return this.headers.has(name.toLowerCase());\n }\n\n /**\n * Retrieves the first value of a given header.\n *\n * @param name The header name.\n *\n * @returns The value string if the header exists, null otherwise\n */\n get(name: string): string | null {\n this.init();\n\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }\n\n /**\n * Retrieves the names of the headers.\n *\n * @returns A list of header names.\n */\n keys(): string[] {\n this.init();\n\n return Array.from(this.normalizedNames.values());\n }\n\n /**\n * Retrieves a list of values for a given header.\n *\n * @param name The header name from which to retrieve values.\n *\n * @returns A string of values if the header exists, null otherwise.\n */\n getAll(name: string): string[] | null {\n this.init();\n\n return this.headers.get(name.toLowerCase()) || null;\n }\n\n /**\n * Appends a new value to the existing set of values for a header\n * and returns them in a clone of the original instance.\n *\n * @param name The header name for which to append the values.\n * @param value The value to append.\n *\n * @returns A clone of the HTTP headers object with the value appended to the given header.\n */\n\n append(name: string, value: string | string[]): HttpHeaders {\n return this.clone({name, value, op: 'a'});\n }\n /**\n * Sets or modifies a value for a given header in a clone of the original instance.\n * If the header already exists, its value is replaced with the given value\n * in the returned object.\n *\n * @param name The header name.\n * @param value The value or values to set or override for the given header.\n *\n * @returns A clone of the HTTP headers object with the newly set header value.\n */\n set(name: string, value: string | string[]): HttpHeaders {\n return this.clone({name, value, op: 's'});\n }\n /**\n * Deletes values for a given header in a clone of the original instance.\n *\n * @param name The header name.\n * @param value The value or values to delete for the given header.\n *\n * @returns A clone of the HTTP headers object with the given value deleted.\n */\n delete(name: string, value?: string | string[]): HttpHeaders {\n return this.clone({name, value, op: 'd'});\n }\n\n private maybeSetNormalizedName(name: string, lcName: string): void {\n if (!this.normalizedNames.has(lcName)) {\n this.normalizedNames.set(lcName, name);\n }\n }\n\n private init(): void {\n if (!!this.lazyInit) {\n if (this.lazyInit instanceof HttpHeaders) {\n this.copyFrom(this.lazyInit);\n } else {\n this.lazyInit();\n }\n this.lazyInit = null;\n if (!!this.lazyUpdate) {\n this.lazyUpdate.forEach((update) => this.applyUpdate(update));\n this.lazyUpdate = null;\n }\n }\n }\n\n private copyFrom(other: HttpHeaders) {\n other.init();\n Array.from(other.headers.keys()).forEach((key) => {\n this.headers.set(key, other.headers.get(key)!);\n this.normalizedNames.set(key, other.normalizedNames.get(key)!);\n });\n }\n\n private clone(update: Update): HttpHeaders {\n const clone = new HttpHeaders();\n clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof HttpHeaders ? this.lazyInit : this;\n clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);\n return clone;\n }\n\n private applyUpdate(update: Update): void {\n const key = update.name.toLowerCase();\n switch (update.op) {\n case 'a':\n case 's':\n let value = update.value!;\n if (typeof value === 'string') {\n value = [value];\n }\n if (value.length === 0) {\n return;\n }\n this.maybeSetNormalizedName(update.name, key);\n const base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];\n base.push(...value);\n this.headers.set(key, base);\n break;\n case 'd':\n const toDelete = update.value as string | undefined;\n if (!toDelete) {\n this.headers.delete(key);\n this.normalizedNames.delete(key);\n } else {\n let existing = this.headers.get(key);\n if (!existing) {\n return;\n }\n existing = existing.filter((value) => toDelete.indexOf(value) === -1);\n if (existing.length === 0) {\n this.headers.delete(key);\n this.normalizedNames.delete(key);\n } else {\n this.headers.set(key, existing);\n }\n }\n break;\n }\n }\n\n private setHeaderEntries(name: string, values: any) {\n const headerValues = (Array.isArray(values) ? values : [values]).map((value) =>\n value.toString(),\n );\n const key = name.toLowerCase();\n this.headers.set(key, headerValues);\n this.maybeSetNormalizedName(name, key);\n }\n\n /**\n * @internal\n */\n forEach(fn: (name: string, values: string[]) => void) {\n this.init();\n Array.from(this.normalizedNames.keys()).forEach((key) =>\n fn(this.normalizedNames.get(key)!, this.headers.get(key)!),\n );\n }\n}\n\n/**\n * Verifies that the headers object has the right shape: the values\n * must be either strings, numbers or arrays. Throws an error if an invalid\n * header value is present.\n */\nfunction assertValidHeaders(\n headers: Record | Headers,\n): asserts headers is Record {\n for (const [key, value] of Object.entries(headers)) {\n if (!(typeof value === 'string' || typeof value === 'number') && !Array.isArray(value)) {\n throw new Error(\n `Unexpected value of the \\`${key}\\` header provided. ` +\n `Expecting either a string, a number or an array, but got: \\`${value}\\`.`,\n );\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A codec for encoding and decoding parameters in URLs.\n *\n * Used by `HttpParams`.\n *\n * @publicApi\n **/\nexport interface HttpParameterCodec {\n encodeKey(key: string): string;\n encodeValue(value: string): string;\n\n decodeKey(key: string): string;\n decodeValue(value: string): string;\n}\n\n/**\n * Provides encoding and decoding of URL parameter and query-string values.\n *\n * Serializes and parses URL parameter keys and values to encode and decode them.\n * If you pass URL query parameters without encoding,\n * the query parameters can be misinterpreted at the receiving end.\n *\n *\n * @publicApi\n */\nexport class HttpUrlEncodingCodec implements HttpParameterCodec {\n /**\n * Encodes a key name for a URL parameter or query-string.\n * @param key The key name.\n * @returns The encoded key name.\n */\n encodeKey(key: string): string {\n return standardEncoding(key);\n }\n\n /**\n * Encodes the value of a URL parameter or query-string.\n * @param value The value.\n * @returns The encoded value.\n */\n encodeValue(value: string): string {\n return standardEncoding(value);\n }\n\n /**\n * Decodes an encoded URL parameter or query-string key.\n * @param key The encoded key name.\n * @returns The decoded key name.\n */\n decodeKey(key: string): string {\n return decodeURIComponent(key);\n }\n\n /**\n * Decodes an encoded URL parameter or query-string value.\n * @param value The encoded value.\n * @returns The decoded value.\n */\n decodeValue(value: string) {\n return decodeURIComponent(value);\n }\n}\n\nfunction paramParser(rawParams: string, codec: HttpParameterCodec): Map {\n const map = new Map();\n if (rawParams.length > 0) {\n // The `window.location.search` can be used while creating an instance of the `HttpParams` class\n // (e.g. `new HttpParams({ fromString: window.location.search })`). The `window.location.search`\n // may start with the `?` char, so we strip it if it's present.\n const params: string[] = rawParams.replace(/^\\?/, '').split('&');\n params.forEach((param: string) => {\n const eqIdx = param.indexOf('=');\n const [key, val]: string[] =\n eqIdx == -1\n ? [codec.decodeKey(param), '']\n : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];\n const list = map.get(key) || [];\n list.push(val);\n map.set(key, list);\n });\n }\n return map;\n}\n\n/**\n * Encode input string with standard encodeURIComponent and then un-encode specific characters.\n */\nconst STANDARD_ENCODING_REGEX = /%(\\d[a-f0-9])/gi;\nconst STANDARD_ENCODING_REPLACEMENTS: {[x: string]: string} = {\n '40': '@',\n '3A': ':',\n '24': '$',\n '2C': ',',\n '3B': ';',\n '3D': '=',\n '3F': '?',\n '2F': '/',\n};\n\nfunction standardEncoding(v: string): string {\n return encodeURIComponent(v).replace(\n STANDARD_ENCODING_REGEX,\n (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s,\n );\n}\n\nfunction valueToString(value: string | number | boolean): string {\n return `${value}`;\n}\n\ninterface Update {\n param: string;\n value?: string | number | boolean;\n op: 'a' | 'd' | 's';\n}\n\n/**\n * Options used to construct an `HttpParams` instance.\n *\n * @publicApi\n */\nexport interface HttpParamsOptions {\n /**\n * String representation of the HTTP parameters in URL-query-string format.\n * Mutually exclusive with `fromObject`.\n */\n fromString?: string;\n\n /** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */\n fromObject?: {\n [param: string]: string | number | boolean | ReadonlyArray;\n };\n\n /** Encoding codec used to parse and serialize the parameters. */\n encoder?: HttpParameterCodec;\n}\n\n/**\n * An HTTP request/response body that represents serialized parameters,\n * per the MIME type `application/x-www-form-urlencoded`.\n *\n * This class is immutable; all mutation operations return a new instance.\n *\n * @publicApi\n */\nexport class HttpParams {\n private map: Map | null;\n private encoder: HttpParameterCodec;\n private updates: Update[] | null = null;\n private cloneFrom: HttpParams | null = null;\n\n constructor(options: HttpParamsOptions = {} as HttpParamsOptions) {\n this.encoder = options.encoder || new HttpUrlEncodingCodec();\n if (!!options.fromString) {\n if (!!options.fromObject) {\n throw new Error(`Cannot specify both fromString and fromObject.`);\n }\n this.map = paramParser(options.fromString, this.encoder);\n } else if (!!options.fromObject) {\n this.map = new Map();\n Object.keys(options.fromObject).forEach((key) => {\n const value = (options.fromObject as any)[key];\n // convert the values to strings\n const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];\n this.map!.set(key, values);\n });\n } else {\n this.map = null;\n }\n }\n\n /**\n * Reports whether the body includes one or more values for a given parameter.\n * @param param The parameter name.\n * @returns True if the parameter has one or more values,\n * false if it has no value or is not present.\n */\n has(param: string): boolean {\n this.init();\n return this.map!.has(param);\n }\n\n /**\n * Retrieves the first value for a parameter.\n * @param param The parameter name.\n * @returns The first value of the given parameter,\n * or `null` if the parameter is not present.\n */\n get(param: string): string | null {\n this.init();\n const res = this.map!.get(param);\n return !!res ? res[0] : null;\n }\n\n /**\n * Retrieves all values for a parameter.\n * @param param The parameter name.\n * @returns All values in a string array,\n * or `null` if the parameter not present.\n */\n getAll(param: string): string[] | null {\n this.init();\n return this.map!.get(param) || null;\n }\n\n /**\n * Retrieves all the parameters for this body.\n * @returns The parameter names in a string array.\n */\n keys(): string[] {\n this.init();\n return Array.from(this.map!.keys());\n }\n\n /**\n * Appends a new value to existing values for a parameter.\n * @param param The parameter name.\n * @param value The new value to add.\n * @return A new body with the appended value.\n */\n append(param: string, value: string | number | boolean): HttpParams {\n return this.clone({param, value, op: 'a'});\n }\n\n /**\n * Constructs a new body with appended values for the given parameter name.\n * @param params parameters and values\n * @return A new body with the new value.\n */\n appendAll(params: {\n [param: string]: string | number | boolean | ReadonlyArray;\n }): HttpParams {\n const updates: Update[] = [];\n Object.keys(params).forEach((param) => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach((_value) => {\n updates.push({param, value: _value, op: 'a'});\n });\n } else {\n updates.push({param, value: value as string | number | boolean, op: 'a'});\n }\n });\n return this.clone(updates);\n }\n\n /**\n * Replaces the value for a parameter.\n * @param param The parameter name.\n * @param value The new value.\n * @return A new body with the new value.\n */\n set(param: string, value: string | number | boolean): HttpParams {\n return this.clone({param, value, op: 's'});\n }\n\n /**\n * Removes a given value or all values from a parameter.\n * @param param The parameter name.\n * @param value The value to remove, if provided.\n * @return A new body with the given value removed, or with all values\n * removed if no value is specified.\n */\n delete(param: string, value?: string | number | boolean): HttpParams {\n return this.clone({param, value, op: 'd'});\n }\n\n /**\n * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are\n * separated by `&`s.\n */\n toString(): string {\n this.init();\n return (\n this.keys()\n .map((key) => {\n const eKey = this.encoder.encodeKey(key);\n // `a: ['1']` produces `'a=1'`\n // `b: []` produces `''`\n // `c: ['1', '2']` produces `'c=1&c=2'`\n return this.map!.get(key)!\n .map((value) => eKey + '=' + this.encoder.encodeValue(value))\n .join('&');\n })\n // filter out empty values because `b: []` produces `''`\n // which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't\n .filter((param) => param !== '')\n .join('&')\n );\n }\n\n private clone(update: Update | Update[]): HttpParams {\n const clone = new HttpParams({encoder: this.encoder} as HttpParamsOptions);\n clone.cloneFrom = this.cloneFrom || this;\n clone.updates = (this.updates || []).concat(update);\n return clone;\n }\n\n private init() {\n if (this.map === null) {\n this.map = new Map();\n }\n if (this.cloneFrom !== null) {\n this.cloneFrom.init();\n this.cloneFrom.keys().forEach((key) => this.map!.set(key, this.cloneFrom!.map!.get(key)!));\n this.updates!.forEach((update) => {\n switch (update.op) {\n case 'a':\n case 's':\n const base = (update.op === 'a' ? this.map!.get(update.param) : undefined) || [];\n base.push(valueToString(update.value!));\n this.map!.set(update.param, base);\n break;\n case 'd':\n if (update.value !== undefined) {\n let base = this.map!.get(update.param) || [];\n const idx = base.indexOf(valueToString(update.value));\n if (idx !== -1) {\n base.splice(idx, 1);\n }\n if (base.length > 0) {\n this.map!.set(update.param, base);\n } else {\n this.map!.delete(update.param);\n }\n } else {\n this.map!.delete(update.param);\n break;\n }\n }\n });\n this.cloneFrom = this.updates = null;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A token used to manipulate and access values stored in `HttpContext`.\n *\n * @publicApi\n */\nexport class HttpContextToken {\n constructor(public readonly defaultValue: () => T) {}\n}\n\n/**\n * Http context stores arbitrary user defined values and ensures type safety without\n * actually knowing the types. It is backed by a `Map` and guarantees that keys do not clash.\n *\n * This context is mutable and is shared between cloned requests unless explicitly specified.\n *\n * @usageNotes\n *\n * ### Usage Example\n *\n * ```typescript\n * // inside cache.interceptors.ts\n * export const IS_CACHE_ENABLED = new HttpContextToken(() => false);\n *\n * export class CacheInterceptor implements HttpInterceptor {\n *\n * intercept(req: HttpRequest, delegate: HttpHandler): Observable> {\n * if (req.context.get(IS_CACHE_ENABLED) === true) {\n * return ...;\n * }\n * return delegate.handle(req);\n * }\n * }\n *\n * // inside a service\n *\n * this.httpClient.get('/api/weather', {\n * context: new HttpContext().set(IS_CACHE_ENABLED, true)\n * }).subscribe(...);\n * ```\n *\n * @publicApi\n */\nexport class HttpContext {\n private readonly map = new Map, unknown>();\n\n /**\n * Store a value in the context. If a value is already present it will be overwritten.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n * @param value The value to store.\n *\n * @returns A reference to itself for easy chaining.\n */\n set(token: HttpContextToken, value: T): HttpContext {\n this.map.set(token, value);\n return this;\n }\n\n /**\n * Retrieve the value associated with the given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns The stored value or default if one is defined.\n */\n get(token: HttpContextToken): T {\n if (!this.map.has(token)) {\n this.map.set(token, token.defaultValue());\n }\n return this.map.get(token) as T;\n }\n\n /**\n * Delete the value associated with the given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns A reference to itself for easy chaining.\n */\n delete(token: HttpContextToken): HttpContext {\n this.map.delete(token);\n return this;\n }\n\n /**\n * Checks for existence of a given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns True if the token exists, false otherwise.\n */\n has(token: HttpContextToken): boolean {\n return this.map.has(token);\n }\n\n /**\n * @returns a list of tokens currently stored in the context.\n */\n keys(): IterableIterator> {\n return this.map.keys();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HttpContext} from './context';\nimport {HttpHeaders} from './headers';\nimport {HttpParams} from './params';\n\n/**\n * Construction interface for `HttpRequest`s.\n *\n * All values are optional and will override default values if provided.\n */\ninterface HttpRequestInit {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n}\n\n/**\n * Determine whether the given HTTP method may include a body.\n */\nfunction mightHaveBody(method: string): boolean {\n switch (method) {\n case 'DELETE':\n case 'GET':\n case 'HEAD':\n case 'OPTIONS':\n case 'JSONP':\n return false;\n default:\n return true;\n }\n}\n\n/**\n * Safely assert whether the given value is an ArrayBuffer.\n *\n * In some execution environments ArrayBuffer is not defined.\n */\nfunction isArrayBuffer(value: any): value is ArrayBuffer {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}\n\n/**\n * Safely assert whether the given value is a Blob.\n *\n * In some execution environments Blob is not defined.\n */\nfunction isBlob(value: any): value is Blob {\n return typeof Blob !== 'undefined' && value instanceof Blob;\n}\n\n/**\n * Safely assert whether the given value is a FormData instance.\n *\n * In some execution environments FormData is not defined.\n */\nfunction isFormData(value: any): value is FormData {\n return typeof FormData !== 'undefined' && value instanceof FormData;\n}\n\n/**\n * Safely assert whether the given value is a URLSearchParams instance.\n *\n * In some execution environments URLSearchParams is not defined.\n */\nfunction isUrlSearchParams(value: any): value is URLSearchParams {\n return typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams;\n}\n\n/**\n * An outgoing HTTP request with an optional typed body.\n *\n * `HttpRequest` represents an outgoing request, including URL, method,\n * headers, body, and other request configuration options. Instances should be\n * assumed to be immutable. To modify a `HttpRequest`, the `clone`\n * method should be used.\n *\n * @publicApi\n */\nexport class HttpRequest {\n /**\n * The request body, or `null` if one isn't set.\n *\n * Bodies are not enforced to be immutable, as they can include a reference to any\n * user-defined data type. However, interceptors should take care to preserve\n * idempotence by treating them as such.\n */\n readonly body: T | null = null;\n\n /**\n * Outgoing headers for this request.\n */\n // TODO(issue/24571): remove '!'.\n readonly headers!: HttpHeaders;\n\n /**\n * Shared and mutable context that can be used by interceptors\n */\n readonly context!: HttpContext;\n\n /**\n * Whether this request should be made in a way that exposes progress events.\n *\n * Progress events are expensive (change detection runs on each event) and so\n * they should only be requested if the consumer intends to monitor them.\n *\n * Note: The `FetchBackend` doesn't support progress report on uploads.\n */\n readonly reportProgress: boolean = false;\n\n /**\n * Whether this request should be sent with outgoing credentials (cookies).\n */\n readonly withCredentials: boolean = false;\n\n /**\n * The expected response type of the server.\n *\n * This is used to parse the response appropriately before returning it to\n * the requestee.\n */\n readonly responseType: 'arraybuffer' | 'blob' | 'json' | 'text' = 'json';\n\n /**\n * The outgoing HTTP request method.\n */\n readonly method: string;\n\n /**\n * Outgoing URL parameters.\n *\n * To pass a string representation of HTTP parameters in the URL-query-string format,\n * the `HttpParamsOptions`' `fromString` may be used. For example:\n *\n * ```\n * new HttpParams({fromString: 'angular=awesome'})\n * ```\n */\n // TODO(issue/24571): remove '!'.\n readonly params!: HttpParams;\n\n /**\n * The outgoing URL with all URL parameters set.\n */\n readonly urlWithParams: string;\n\n /**\n * The HttpTransferCache option for the request\n */\n readonly transferCache?: {includeHeaders?: string[]} | boolean;\n\n constructor(\n method: 'GET' | 'HEAD',\n url: string,\n init?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n /**\n * This property accepts either a boolean to enable/disable transferring cache for eligible\n * requests performed using `HttpClient`, or an object, which allows to configure cache\n * parameters, such as which headers should be included (no headers are included by default).\n *\n * Setting this property will override the options passed to `provideClientHydration()` for this\n * particular request\n */\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n );\n constructor(\n method: 'DELETE' | 'JSONP' | 'OPTIONS',\n url: string,\n init?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n },\n );\n constructor(\n method: 'POST',\n url: string,\n body: T | null,\n init?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n /**\n * This property accepts either a boolean to enable/disable transferring cache for eligible\n * requests performed using `HttpClient`, or an object, which allows to configure cache\n * parameters, such as which headers should be included (no headers are included by default).\n *\n * Setting this property will override the options passed to `provideClientHydration()` for this\n * particular request\n */\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n );\n constructor(\n method: 'PUT' | 'PATCH',\n url: string,\n body: T | null,\n init?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n },\n );\n constructor(\n method: string,\n url: string,\n body: T | null,\n init?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n /**\n * This property accepts either a boolean to enable/disable transferring cache for eligible\n * requests performed using `HttpClient`, or an object, which allows to configure cache\n * parameters, such as which headers should be included (no headers are included by default).\n *\n * Setting this property will override the options passed to `provideClientHydration()` for this\n * particular request\n */\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n );\n constructor(\n method: string,\n readonly url: string,\n third?:\n | T\n | {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n }\n | null,\n fourth?: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ) {\n this.method = method.toUpperCase();\n // Next, need to figure out which argument holds the HttpRequestInit\n // options, if any.\n let options: HttpRequestInit | undefined;\n\n // Check whether a body argument is expected. The only valid way to omit\n // the body argument is to use a known no-body method like GET.\n if (mightHaveBody(this.method) || !!fourth) {\n // Body is the third argument, options are the fourth.\n this.body = third !== undefined ? (third as T) : null;\n options = fourth;\n } else {\n // No body required, options are the third argument. The body stays null.\n options = third as HttpRequestInit;\n }\n\n // If options have been passed, interpret them.\n if (options) {\n // Normalize reportProgress and withCredentials.\n this.reportProgress = !!options.reportProgress;\n this.withCredentials = !!options.withCredentials;\n\n // Override default response type of 'json' if one is provided.\n if (!!options.responseType) {\n this.responseType = options.responseType;\n }\n\n // Override headers if they're provided.\n if (!!options.headers) {\n this.headers = options.headers;\n }\n\n if (!!options.context) {\n this.context = options.context;\n }\n\n if (!!options.params) {\n this.params = options.params;\n }\n\n // We do want to assign transferCache even if it's falsy (false is valid value)\n this.transferCache = options.transferCache;\n }\n\n // If no headers have been passed in, construct a new HttpHeaders instance.\n this.headers ??= new HttpHeaders();\n\n // If no context have been passed in, construct a new HttpContext instance.\n this.context ??= new HttpContext();\n\n // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.\n if (!this.params) {\n this.params = new HttpParams();\n this.urlWithParams = url;\n } else {\n // Encode the parameters to a string in preparation for inclusion in the URL.\n const params = this.params.toString();\n if (params.length === 0) {\n // No parameters, the visible URL is just the URL given at creation time.\n this.urlWithParams = url;\n } else {\n // Does the URL already have query parameters? Look for '?'.\n const qIdx = url.indexOf('?');\n // There are 3 cases to handle:\n // 1) No existing parameters -> append '?' followed by params.\n // 2) '?' exists and is followed by existing query string ->\n // append '&' followed by params.\n // 3) '?' exists at the end of the url -> append params directly.\n // This basically amounts to determining the character, if any, with\n // which to join the URL and parameters.\n const sep: string = qIdx === -1 ? '?' : qIdx < url.length - 1 ? '&' : '';\n this.urlWithParams = url + sep + params;\n }\n }\n }\n\n /**\n * Transform the free-form body into a serialized format suitable for\n * transmission to the server.\n */\n serializeBody(): ArrayBuffer | Blob | FormData | URLSearchParams | string | null {\n // If no body is present, no need to serialize it.\n if (this.body === null) {\n return null;\n }\n // Check whether the body is already in a serialized form. If so,\n // it can just be returned directly.\n if (\n isArrayBuffer(this.body) ||\n isBlob(this.body) ||\n isFormData(this.body) ||\n isUrlSearchParams(this.body) ||\n typeof this.body === 'string'\n ) {\n return this.body;\n }\n // Check whether the body is an instance of HttpUrlEncodedParams.\n if (this.body instanceof HttpParams) {\n return this.body.toString();\n }\n // Check whether the body is an object or array, and serialize with JSON if so.\n if (\n typeof this.body === 'object' ||\n typeof this.body === 'boolean' ||\n Array.isArray(this.body)\n ) {\n return JSON.stringify(this.body);\n }\n // Fall back on toString() for everything else.\n return (this.body as any).toString();\n }\n\n /**\n * Examine the body and attempt to infer an appropriate MIME type\n * for it.\n *\n * If no such type can be inferred, this method will return `null`.\n */\n detectContentTypeHeader(): string | null {\n // An empty body has no content type.\n if (this.body === null) {\n return null;\n }\n // FormData bodies rely on the browser's content type assignment.\n if (isFormData(this.body)) {\n return null;\n }\n // Blobs usually have their own content type. If it doesn't, then\n // no type can be inferred.\n if (isBlob(this.body)) {\n return this.body.type || null;\n }\n // Array buffers have unknown contents and thus no type can be inferred.\n if (isArrayBuffer(this.body)) {\n return null;\n }\n // Technically, strings could be a form of JSON data, but it's safe enough\n // to assume they're plain strings.\n if (typeof this.body === 'string') {\n return 'text/plain';\n }\n // `HttpUrlEncodedParams` has its own content-type.\n if (this.body instanceof HttpParams) {\n return 'application/x-www-form-urlencoded;charset=UTF-8';\n }\n // Arrays, objects, boolean and numbers will be encoded as JSON.\n if (\n typeof this.body === 'object' ||\n typeof this.body === 'number' ||\n typeof this.body === 'boolean'\n ) {\n return 'application/json';\n }\n // No type could be inferred.\n return null;\n }\n\n clone(): HttpRequest;\n clone(update: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: T | null;\n method?: string;\n url?: string;\n setHeaders?: {[name: string]: string | string[]};\n setParams?: {[param: string]: string};\n }): HttpRequest;\n clone(update: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: V | null;\n method?: string;\n url?: string;\n setHeaders?: {[name: string]: string | string[]};\n setParams?: {[param: string]: string};\n }): HttpRequest;\n clone(\n update: {\n headers?: HttpHeaders;\n context?: HttpContext;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n method?: string;\n url?: string;\n setHeaders?: {[name: string]: string | string[]};\n setParams?: {[param: string]: string};\n } = {},\n ): HttpRequest {\n // For method, url, and responseType, take the current value unless\n // it is overridden in the update hash.\n const method = update.method || this.method;\n const url = update.url || this.url;\n const responseType = update.responseType || this.responseType;\n\n // The body is somewhat special - a `null` value in update.body means\n // whatever current body is present is being overridden with an empty\n // body, whereas an `undefined` value in update.body implies no\n // override.\n const body = update.body !== undefined ? update.body : this.body;\n\n // Carefully handle the boolean options to differentiate between\n // `false` and `undefined` in the update args.\n const withCredentials =\n update.withCredentials !== undefined ? update.withCredentials : this.withCredentials;\n const reportProgress =\n update.reportProgress !== undefined ? update.reportProgress : this.reportProgress;\n\n // Headers and params may be appended to if `setHeaders` or\n // `setParams` are used.\n let headers = update.headers || this.headers;\n let params = update.params || this.params;\n\n // Pass on context if needed\n const context = update.context ?? this.context;\n\n // Check whether the caller has asked to add headers.\n if (update.setHeaders !== undefined) {\n // Set every requested header.\n headers = Object.keys(update.setHeaders).reduce(\n (headers, name) => headers.set(name, update.setHeaders![name]),\n headers,\n );\n }\n\n // Check whether the caller has asked to set params.\n if (update.setParams) {\n // Set every requested param.\n params = Object.keys(update.setParams).reduce(\n (params, param) => params.set(param, update.setParams![param]),\n params,\n );\n }\n\n // Finally, construct the new HttpRequest using the pieces from above.\n return new HttpRequest(method, url, body, {\n params,\n headers,\n context,\n reportProgress,\n responseType,\n withCredentials,\n });\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {HttpHeaders} from './headers';\n\n/**\n * Type enumeration for the different kinds of `HttpEvent`.\n *\n * @publicApi\n */\nexport enum HttpEventType {\n /**\n * The request was sent out over the wire.\n */\n Sent,\n\n /**\n * An upload progress event was received.\n *\n * Note: The `FetchBackend` doesn't support progress report on uploads.\n */\n UploadProgress,\n\n /**\n * The response status code and headers were received.\n */\n ResponseHeader,\n\n /**\n * A download progress event was received.\n */\n DownloadProgress,\n\n /**\n * The full response including the body was received.\n */\n Response,\n\n /**\n * A custom event from an interceptor or a backend.\n */\n User,\n}\n\n/**\n * Base interface for progress events.\n *\n * @publicApi\n */\nexport interface HttpProgressEvent {\n /**\n * Progress event type is either upload or download.\n */\n type: HttpEventType.DownloadProgress | HttpEventType.UploadProgress;\n\n /**\n * Number of bytes uploaded or downloaded.\n */\n loaded: number;\n\n /**\n * Total number of bytes to upload or download. Depending on the request or\n * response, this may not be computable and thus may not be present.\n */\n total?: number;\n}\n\n/**\n * A download progress event.\n *\n * @publicApi\n */\nexport interface HttpDownloadProgressEvent extends HttpProgressEvent {\n type: HttpEventType.DownloadProgress;\n\n /**\n * The partial response body as downloaded so far.\n *\n * Only present if the responseType was `text`.\n */\n partialText?: string;\n}\n\n/**\n * An upload progress event.\n *\n * Note: The `FetchBackend` doesn't support progress report on uploads.\n *\n * @publicApi\n */\nexport interface HttpUploadProgressEvent extends HttpProgressEvent {\n type: HttpEventType.UploadProgress;\n}\n\n/**\n * An event indicating that the request was sent to the server. Useful\n * when a request may be retried multiple times, to distinguish between\n * retries on the final event stream.\n *\n * @publicApi\n */\nexport interface HttpSentEvent {\n type: HttpEventType.Sent;\n}\n\n/**\n * A user-defined event.\n *\n * Grouping all custom events under this type ensures they will be handled\n * and forwarded by all implementations of interceptors.\n *\n * @publicApi\n */\nexport interface HttpUserEvent {\n type: HttpEventType.User;\n}\n\n/**\n * An error that represents a failed attempt to JSON.parse text coming back\n * from the server.\n *\n * It bundles the Error object with the actual response body that failed to parse.\n *\n *\n */\nexport interface HttpJsonParseError {\n error: Error;\n text: string;\n}\n\n/**\n * Union type for all possible events on the response stream.\n *\n * Typed according to the expected type of the response.\n *\n * @publicApi\n */\nexport type HttpEvent =\n | HttpSentEvent\n | HttpHeaderResponse\n | HttpResponse\n | HttpProgressEvent\n | HttpUserEvent;\n\n/**\n * Base class for both `HttpResponse` and `HttpHeaderResponse`.\n *\n * @publicApi\n */\nexport abstract class HttpResponseBase {\n /**\n * All response headers.\n */\n readonly headers: HttpHeaders;\n\n /**\n * Response status code.\n */\n readonly status: number;\n\n /**\n * Textual description of response status code, defaults to OK.\n *\n * Do not depend on this.\n */\n readonly statusText: string;\n\n /**\n * URL of the resource retrieved, or null if not available.\n */\n readonly url: string | null;\n\n /**\n * Whether the status code falls in the 2xx range.\n */\n readonly ok: boolean;\n\n /**\n * Type of the response, narrowed to either the full response or the header.\n */\n // TODO(issue/24571): remove '!'.\n readonly type!: HttpEventType.Response | HttpEventType.ResponseHeader;\n\n /**\n * Super-constructor for all responses.\n *\n * The single parameter accepted is an initialization hash. Any properties\n * of the response passed there will override the default values.\n */\n constructor(\n init: {\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n },\n defaultStatus: number = HttpStatusCode.Ok,\n defaultStatusText: string = 'OK',\n ) {\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }\n}\n\n/**\n * A partial HTTP response which only includes the status and header data,\n * but no response body.\n *\n * `HttpHeaderResponse` is a `HttpEvent` available on the response\n * event stream, only when progress events are requested.\n *\n * @publicApi\n */\nexport class HttpHeaderResponse extends HttpResponseBase {\n /**\n * Create a new `HttpHeaderResponse` with the given parameters.\n */\n constructor(\n init: {\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n } = {},\n ) {\n super(init);\n }\n\n override readonly type: HttpEventType.ResponseHeader = HttpEventType.ResponseHeader;\n\n /**\n * Copy this `HttpHeaderResponse`, overriding its contents with the\n * given parameter hash.\n */\n clone(\n update: {headers?: HttpHeaders; status?: number; statusText?: string; url?: string} = {},\n ): HttpHeaderResponse {\n // Perform a straightforward initialization of the new HttpHeaderResponse,\n // overriding the current parameters with new ones if given.\n return new HttpHeaderResponse({\n headers: update.headers || this.headers,\n status: update.status !== undefined ? update.status : this.status,\n statusText: update.statusText || this.statusText,\n url: update.url || this.url || undefined,\n });\n }\n}\n\n/**\n * A full HTTP response, including a typed response body (which may be `null`\n * if one was not returned).\n *\n * `HttpResponse` is a `HttpEvent` available on the response event\n * stream.\n *\n * @publicApi\n */\nexport class HttpResponse extends HttpResponseBase {\n /**\n * The response body, or `null` if one was not returned.\n */\n readonly body: T | null;\n\n /**\n * Construct a new `HttpResponse`.\n */\n constructor(\n init: {\n body?: T | null;\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n } = {},\n ) {\n super(init);\n this.body = init.body !== undefined ? init.body : null;\n }\n\n override readonly type: HttpEventType.Response = HttpEventType.Response;\n\n clone(): HttpResponse;\n clone(update: {\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n }): HttpResponse;\n clone(update: {\n body?: V | null;\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n }): HttpResponse;\n clone(\n update: {\n body?: any | null;\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n } = {},\n ): HttpResponse {\n return new HttpResponse({\n body: update.body !== undefined ? update.body : this.body,\n headers: update.headers || this.headers,\n status: update.status !== undefined ? update.status : this.status,\n statusText: update.statusText || this.statusText,\n url: update.url || this.url || undefined,\n });\n }\n}\n\n/**\n * A response that represents an error or failure, either from a\n * non-successful HTTP status, an error while executing the request,\n * or some other failure which occurred during the parsing of the response.\n *\n * Any error returned on the `Observable` response stream will be\n * wrapped in an `HttpErrorResponse` to provide additional context about\n * the state of the HTTP layer when the error occurred. The error property\n * will contain either a wrapped Error object or the error response returned\n * from the server.\n *\n * @publicApi\n */\nexport class HttpErrorResponse extends HttpResponseBase implements Error {\n readonly name = 'HttpErrorResponse';\n readonly message: string;\n readonly error: any | null;\n\n /**\n * Errors are never okay, even when the status code is in the 2xx success range.\n */\n override readonly ok = false;\n\n constructor(init: {\n error?: any;\n headers?: HttpHeaders;\n status?: number;\n statusText?: string;\n url?: string;\n }) {\n // Initialize with a default status of 0 / Unknown Error.\n super(init, 0, 'Unknown Error');\n\n // If the response was successful, then this was a parse error. Otherwise, it was\n // a protocol-level failure of some sort. Either the request failed in transit\n // or the server returned an unsuccessful status code.\n if (this.status >= 200 && this.status < 300) {\n this.message = `Http failure during parsing for ${init.url || '(unknown url)'}`;\n } else {\n this.message = `Http failure response for ${init.url || '(unknown url)'}: ${init.status} ${\n init.statusText\n }`;\n }\n this.error = init.error || null;\n }\n}\n\n/**\n * Http status codes.\n * As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\n * @publicApi\n */\nexport enum HttpStatusCode {\n Continue = 100,\n SwitchingProtocols = 101,\n Processing = 102,\n EarlyHints = 103,\n\n Ok = 200,\n Created = 201,\n Accepted = 202,\n NonAuthoritativeInformation = 203,\n NoContent = 204,\n ResetContent = 205,\n PartialContent = 206,\n MultiStatus = 207,\n AlreadyReported = 208,\n ImUsed = 226,\n\n MultipleChoices = 300,\n MovedPermanently = 301,\n Found = 302,\n SeeOther = 303,\n NotModified = 304,\n UseProxy = 305,\n Unused = 306,\n TemporaryRedirect = 307,\n PermanentRedirect = 308,\n\n BadRequest = 400,\n Unauthorized = 401,\n PaymentRequired = 402,\n Forbidden = 403,\n NotFound = 404,\n MethodNotAllowed = 405,\n NotAcceptable = 406,\n ProxyAuthenticationRequired = 407,\n RequestTimeout = 408,\n Conflict = 409,\n Gone = 410,\n LengthRequired = 411,\n PreconditionFailed = 412,\n PayloadTooLarge = 413,\n UriTooLong = 414,\n UnsupportedMediaType = 415,\n RangeNotSatisfiable = 416,\n ExpectationFailed = 417,\n ImATeapot = 418,\n MisdirectedRequest = 421,\n UnprocessableEntity = 422,\n Locked = 423,\n FailedDependency = 424,\n TooEarly = 425,\n UpgradeRequired = 426,\n PreconditionRequired = 428,\n TooManyRequests = 429,\n RequestHeaderFieldsTooLarge = 431,\n UnavailableForLegalReasons = 451,\n\n InternalServerError = 500,\n NotImplemented = 501,\n BadGateway = 502,\n ServiceUnavailable = 503,\n GatewayTimeout = 504,\n HttpVersionNotSupported = 505,\n VariantAlsoNegotiates = 506,\n InsufficientStorage = 507,\n LoopDetected = 508,\n NotExtended = 510,\n NetworkAuthenticationRequired = 511,\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable} from '@angular/core';\nimport {Observable, of} from 'rxjs';\nimport {concatMap, filter, map} from 'rxjs/operators';\n\nimport {HttpHandler} from './backend';\nimport {HttpContext} from './context';\nimport {HttpHeaders} from './headers';\nimport {HttpParams, HttpParamsOptions} from './params';\nimport {HttpRequest} from './request';\nimport {HttpEvent, HttpResponse} from './response';\n\n/**\n * Constructs an instance of `HttpRequestOptions` from a source `HttpMethodOptions` and\n * the given `body`. This function clones the object and adds the body.\n *\n * Note that the `responseType` *options* value is a String that identifies the\n * single data type of the response.\n * A single overload version of the method handles each response type.\n * The value of `responseType` cannot be a union, as the combined signature could imply.\n *\n */\nfunction addBody(\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n body: T | null,\n): any {\n return {\n body,\n headers: options.headers,\n context: options.context,\n observe: options.observe,\n params: options.params,\n reportProgress: options.reportProgress,\n responseType: options.responseType,\n withCredentials: options.withCredentials,\n transferCache: options.transferCache,\n };\n}\n\n/**\n * Performs HTTP requests.\n * This service is available as an injectable class, with methods to perform HTTP requests.\n * Each request method has multiple signatures, and the return type varies based on\n * the signature that is called (mainly the values of `observe` and `responseType`).\n *\n * Note that the `responseType` *options* value is a String that identifies the\n * single data type of the response.\n * A single overload version of the method handles each response type.\n * The value of `responseType` cannot be a union, as the combined signature could imply.\n\n *\n * @usageNotes\n * Sample HTTP requests for the [Tour of Heroes](/tutorial/tour-of-heroes/toh-pt0) application.\n *\n * ### HTTP Request Example\n *\n * ```\n * // GET heroes whose name contains search term\n * searchHeroes(term: string): observable{\n *\n * const params = new HttpParams({fromString: 'name=term'});\n * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});\n * }\n * ```\n *\n * Alternatively, the parameter string can be used without invoking HttpParams\n * by directly joining to the URL.\n * ```\n * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});\n * ```\n *\n *\n * ### JSONP Example\n * ```\n * requestJsonp(url, callback = 'callback') {\n * return this.httpClient.jsonp(this.heroesURL, callback);\n * }\n * ```\n *\n * ### PATCH Example\n * ```\n * // PATCH one of the heroes' name\n * patchHero (id: number, heroName: string): Observable<{}> {\n * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42\n * return this.httpClient.patch(url, {name: heroName}, httpOptions)\n * .pipe(catchError(this.handleError('patchHero')));\n * }\n * ```\n *\n * @see [HTTP Guide](guide/understanding-communicating-with-http)\n * @see [HTTP Request](api/common/http/HttpRequest)\n *\n * @publicApi\n */\n@Injectable()\nexport class HttpClient {\n constructor(private handler: HttpHandler) {}\n\n /**\n * Sends an `HttpRequest` and returns a stream of `HttpEvent`s.\n *\n * @return An `Observable` of the response, with the response body as a stream of `HttpEvent`s.\n */\n request(req: HttpRequest): Observable>;\n\n /**\n * Constructs a request that interprets the body as an `ArrayBuffer` and returns the response in\n * an `ArrayBuffer`.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a request that interprets the body as a blob and returns\n * the response as a blob.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type `Blob`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a request that interprets the body as a text string and\n * returns a string value.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a request that interprets the body as an `ArrayBuffer` and returns the\n * the full event stream.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as an array of `HttpEvent`s for\n * the request.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n observe: 'events';\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request that interprets the body as a `Blob` and returns\n * the full event stream.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body of type `Blob`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a text string and returns the full event\n * stream.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body of type string.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object and returns the full\n * event stream.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body of type `Object`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n reportProgress?: boolean;\n observe: 'events';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object and returns the full\n * event stream.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body of type `R`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n reportProgress?: boolean;\n observe: 'events';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as an `ArrayBuffer`\n * and returns the full `HttpResponse`.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body as an `ArrayBuffer`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a `Blob` and returns the full `HttpResponse`.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a text stream and returns the full\n * `HttpResponse`.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the HTTP response, with the response body of type string.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object and returns the full\n * `HttpResponse`.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse`,\n * with the response body of type `Object`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n reportProgress?: boolean;\n observe: 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object and returns\n * the full `HttpResponse` with the response body in the requested type.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse`, with the response body of type `R`.\n */\n request(\n method: string,\n url: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n reportProgress?: boolean;\n observe: 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object and returns the full\n * `HttpResponse` as a JavaScript object.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.\n */\n request(\n method: string,\n url: string,\n options?: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n reportProgress?: boolean;\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a request which interprets the body as a JavaScript object\n * with the response body of the requested type.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of type `R`.\n */\n request(\n method: string,\n url: string,\n options?: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n responseType?: 'json';\n reportProgress?: boolean;\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a request where response type and requested observable are not known statically.\n *\n * @param method The HTTP method.\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the requested response, with body of type `any`.\n */\n request(\n method: string,\n url: string,\n options?: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n observe?: 'body' | 'events' | 'response';\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable for a generic HTTP request that, when subscribed,\n * fires the request through the chain of registered interceptors and on to the\n * server.\n *\n * You can pass an `HttpRequest` directly as the only parameter. In this case,\n * the call returns an observable of the raw `HttpEvent` stream.\n *\n * Alternatively you can pass an HTTP method as the first parameter,\n * a URL string as the second, and an options hash containing the request body as the third.\n * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the\n * type of returned observable.\n * * The `responseType` value determines how a successful response body is parsed.\n * * If `responseType` is the default `json`, you can pass a type interface for the resulting\n * object as a type parameter to the call.\n *\n * The `observe` value determines the return type, according to what you are interested in\n * observing.\n * * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including\n * progress events by default.\n * * An `observe` value of response returns an observable of `HttpResponse`,\n * where the `T` parameter depends on the `responseType` and any optionally provided type\n * parameter.\n * * An `observe` value of body returns an observable of `` with the same `T` body type.\n *\n */\n request(\n first: string | HttpRequest,\n url?: string,\n options: {\n body?: any;\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n } = {},\n ): Observable {\n let req: HttpRequest;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n } else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n\n // Figure out the headers.\n let headers: HttpHeaders | undefined = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n } else {\n headers = new HttpHeaders(options.headers);\n }\n\n // Sort out parameters.\n let params: HttpParams | undefined = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n } else {\n params = new HttpParams({fromObject: options.params} as HttpParamsOptions);\n }\n }\n\n // Construct the request.\n req = new HttpRequest(first, url!, options.body !== undefined ? options.body : null, {\n headers,\n context: options.context,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n transferCache: options.transferCache,\n });\n }\n\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$: Observable> = of(req).pipe(\n concatMap((req: HttpRequest) => this.handler.handle(req)),\n );\n\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$: Observable> = >>(\n events$.pipe(filter((event: HttpEvent) => event instanceof HttpResponse))\n );\n\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(\n map((res: HttpResponse) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }),\n );\n case 'blob':\n return res$.pipe(\n map((res: HttpResponse) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }),\n );\n case 'text':\n return res$.pipe(\n map((res: HttpResponse) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }),\n );\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(map((res: HttpResponse) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }\n\n /**\n * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`\n * and returns the response as an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response body as an `ArrayBuffer`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a `Blob` and returns\n * the response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response body as a `Blob`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a text string and returns\n * a string.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable;\n\n /**\n * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer`\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with response body as an `ArrayBuffer`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a `Blob`\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request, with the response body as a\n * `Blob`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a text string\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with the response\n * body of type string.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with response body of\n * type `Object`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE`request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request, with a response\n * body in the requested type.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | (string | number | boolean)[]};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as an `ArrayBuffer` and returns\n * the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse`, with the response body as an `ArrayBuffer`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a `Blob` and returns the full\n * `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of type `Blob`.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as a text stream and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse`, with the response body of type string.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request the interprets the body as a JavaScript object and returns\n * the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of type `Object`.\n *\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with the response body of the requested type.\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable>;\n\n /**\n * Constructs a `DELETE` request that interprets the body as JSON and\n * returns the response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type `Object`.\n */\n delete(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable;\n\n /**\n * Constructs a DELETE request that interprets the body as JSON and returns\n * the response in a given type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with response body in the requested type.\n */\n delete(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n body?: any | null;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `DELETE` request to execute on the server. See the individual overloads for\n * details on the return type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n */\n delete(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n } = {},\n ): Observable {\n return this.request('DELETE', url, options as any);\n }\n\n /**\n * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns the\n * response in an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `GET` request that interprets the body as a `Blob`\n * and returns the response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `GET` request that interprets the body as a text string\n * and returns the response as a string value.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and returns\n * the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with the response\n * body as an `ArrayBuffer`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as a `Blob` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as a text string and returns\n * the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type `Object`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON and returns the full\n * event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with a response body in the requested type.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as an `ArrayBuffer` and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as an `ArrayBuffer`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as a `Blob` and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a `Blob`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as a text stream and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body of type string.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse`,\n * with the response body of type `Object`.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the full `HttpResponse` for the request,\n * with a response body in the requested type.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON and\n * returns the response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n *\n * @return An `Observable` of the response body as a JavaScript object.\n */\n get(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `GET` request that interprets the body as JSON and returns\n * the response body in a given type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse`, with a response body in the requested type.\n */\n get(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `GET` request to execute on the server. See the individual overloads for\n * details on the return type.\n */\n get(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n } = {},\n ): Observable {\n return this.request('GET', url, options as any);\n }\n\n /**\n * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer` and\n * returns the response as an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `HEAD` request that interprets the body as a `Blob` and returns\n * the response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `HEAD` request that interprets the body as a text string and returns the response\n * as a string value.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as an `ArrayBuffer`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as a `Blob` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as a `Blob`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as a text string\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with the response body of type\n * string.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as JSON\n * and returns the full HTTP event stream.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with a response body of\n * type `Object`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as JSON and\n * returns the full event stream.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with a response body in the requested type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as an `ArrayBuffer`\n * and returns the full HTTP response.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as an `ArrayBuffer`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as a `Blob` and returns\n * the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a blob.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as text stream\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body of type string.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as JSON and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body of type `Object`.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `HEAD` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body of the requested type.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n\n * Constructs a `HEAD` request that interprets the body as JSON and\n * returns the response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the response, with the response body as an object parsed from JSON.\n */\n head(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `HEAD` request that interprets the body as JSON and returns\n * the response in a given type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body of the given type.\n */\n head(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `HEAD` request to execute on the server. The `HEAD` method returns\n * meta information about the resource without transferring the\n * resource itself. See the individual overloads for\n * details on the return type.\n */\n head(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n } = {},\n ): Observable {\n return this.request('HEAD', url, options as any);\n }\n\n /**\n * Constructs a `JSONP` request for the given URL and name of the callback parameter.\n *\n * @param url The resource URL.\n * @param callbackParam The callback function name.\n *\n * @return An `Observable` of the response object, with response body as an object.\n */\n jsonp(url: string, callbackParam: string): Observable;\n\n /**\n * Constructs a `JSONP` request for the given URL and name of the callback parameter.\n *\n * @param url The resource URL.\n * @param callbackParam The callback function name.\n *\n * You must install a suitable interceptor, such as one provided by `HttpClientJsonpModule`.\n * If no such interceptor is reached,\n * then the `JSONP` request can be rejected by the configured backend.\n *\n * @return An `Observable` of the response object, with response body in the requested type.\n */\n jsonp(url: string, callbackParam: string): Observable;\n\n /**\n * Constructs an `Observable` that, when subscribed, causes a request with the special method\n * `JSONP` to be dispatched via the interceptor pipeline.\n * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain\n * API endpoints that don't support newer,\n * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.\n * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the\n * requests even if the API endpoint is not located on the same domain (origin) as the client-side\n * application making the request.\n * The endpoint API must support JSONP callback for JSONP requests to work.\n * The resource API returns the JSON response wrapped in a callback function.\n * You can pass the callback function name as one of the query parameters.\n * Note that JSONP requests can only be used with `GET` requests.\n *\n * @param url The resource URL.\n * @param callbackParam The callback function name.\n *\n */\n jsonp(url: string, callbackParam: string): Observable {\n return this.request('JSONP', url, {\n params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),\n observe: 'body',\n responseType: 'json',\n });\n }\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as an\n * `ArrayBuffer` and returns the response as an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as a `Blob` and returns\n * the response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as a text string and\n * returns a string value.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body of type string.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as an `ArrayBuffer`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as a `Blob` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as a `Blob`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as a text string\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with the response body of type string.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request with the response\n * body of type `Object`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as JSON and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with a response body in the requested type.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as an `ArrayBuffer`\n * and returns the full HTTP response.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as an `ArrayBuffer`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as a `Blob`\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a `Blob`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as text stream\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body of type string.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body of type `Object`.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as JSON and\n * returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body in the requested type.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n\n * Constructs an `OPTIONS` request that interprets the body as JSON and returns the\n * response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as an object parsed from JSON.\n */\n options(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an `OPTIONS` request that interprets the body as JSON and returns the\n * response in a given type.\n *\n * @param url The endpoint URL.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse`, with a response body of the given type.\n */\n options(\n url: string,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an `Observable` that, when subscribed, causes the configured\n * `OPTIONS` request to execute on the server. This method allows the client\n * to determine the supported HTTP methods and other capabilities of an endpoint,\n * without implying a resource action. See the individual overloads for\n * details on the return type.\n */\n options(\n url: string,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n } = {},\n ): Observable {\n return this.request('OPTIONS', url, options as any);\n }\n\n /**\n * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and returns\n * the response as an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the response\n * as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a text string and\n * returns the response as a string value.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with a response body of type string.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with the response body as an `ArrayBuffer`.\n */\n\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a `Blob`\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request, with the\n * response body as `Blob`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a text string and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request, with a\n * response body of type string.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with a response body of type `Object`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as JSON\n * and returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of all the `HttpEvent`s for the request,\n * with a response body in the requested type.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as an `ArrayBuffer`\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as an `ArrayBuffer`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a `Blob` and returns the full\n * `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a `Blob`.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as a text stream and returns the\n * full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body of type string.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body in the requested type.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PATCH` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body in the given type.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n\n * Constructs a `PATCH` request that interprets the body as JSON and\n * returns the response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as an object parsed from JSON.\n */\n patch(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PATCH` request that interprets the body as JSON\n * and returns the response in a given type.\n *\n * @param url The endpoint URL.\n * @param body The resources to edit.\n * @param options HTTP options.\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body in the given type.\n */\n patch(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `PATCH` request to execute on the server. See the individual overloads for\n * details on the return type.\n */\n patch(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n } = {},\n ): Observable {\n return this.request('PATCH', url, addBody(options, body));\n }\n\n /**\n * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and returns\n * an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options.\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `POST` request that interprets the body as a `Blob` and returns the\n * response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `POST` request that interprets the body as a text string and\n * returns the response as a string value.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with a response body of type string.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `POST` request that interprets the body as an `ArrayBuffer` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as an `ArrayBuffer`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as a `Blob`\n * and returns the response in an observable of the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with the response body as `Blob`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as a text string and returns the full\n * event stream.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with a response body of type string.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a POST request that interprets the body as JSON and returns the full\n * event stream.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with a response body of type `Object`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a POST request that interprets the body as JSON and returns the full\n * event stream.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with a response body in the requested type.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a POST request that interprets the body as an `ArrayBuffer`\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with the response body as an\n * `ArrayBuffer`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as a `Blob` and returns the full\n * `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a `Blob`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as a text stream and returns\n * the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body of type string.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as JSON\n * and returns the full `HttpResponse`.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with a response body of type\n * `Object`.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as JSON and returns the\n * full `HttpResponse`.\n *\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with a response body in the\n * requested type.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `POST` request that interprets the body as JSON\n * and returns the response body as an object parsed from JSON.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with the response body as an object parsed from JSON.\n */\n post(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `POST` request that interprets the body as JSON\n * and returns an observable of the response.\n *\n * @param url The endpoint URL.\n * @param body The content to replace with.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with a response body in the\n * requested type.\n */\n post(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `POST` request to execute on the server. The server responds with the location of\n * the replaced resource. See the individual overloads for\n * details on the return type.\n */\n post(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n transferCache?: {includeHeaders?: string[]} | boolean;\n } = {},\n ): Observable {\n return this.request('POST', url, addBody(options, body));\n }\n\n /**\n * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and returns the\n * response as an `ArrayBuffer`.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PUT` request that interprets the body as a `Blob` and returns\n * the response as a `Blob`.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with the response body as a `Blob`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PUT` request that interprets the body as a text string and\n * returns the response as a string value.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the response, with a response body of type string.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PUT` request that interprets the body as an `ArrayBuffer` and\n * returns the full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as an `ArrayBuffer`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as a `Blob` and returns the full event\n * stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with the response body as a `Blob`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as a text string and returns the full event\n * stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with a response body\n * of type string.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as JSON and returns the full\n * event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request, with a response body of\n * type `Object`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as JSON and returns the\n * full event stream.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of all `HttpEvent`s for the request,\n * with a response body in the requested type.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'events';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as an\n * `ArrayBuffer` and returns an observable of the full HTTP response.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with the response body as an\n * `ArrayBuffer`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'arraybuffer';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as a `Blob` and returns the\n * full HTTP response.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with the response body as a `Blob`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'blob';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as a text stream and returns the\n * full HTTP response.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with a response body of type\n * string.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType: 'text';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as JSON and returns the full\n * HTTP response.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request, with a response body\n * of type 'Object`.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as an instance of the requested type and\n * returns the full HTTP response.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the `HttpResponse` for the request,\n * with a response body in the requested type.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n observe: 'response';\n context?: HttpContext;\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable>;\n\n /**\n * Constructs a `PUT` request that interprets the body as JSON\n * and returns an observable of JavaScript object.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the response as a JavaScript object.\n */\n put(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs a `PUT` request that interprets the body as an instance of the requested type\n * and returns an observable of the requested type.\n *\n * @param url The endpoint URL.\n * @param body The resources to add/update.\n * @param options HTTP options\n *\n * @return An `Observable` of the requested type.\n */\n put(\n url: string,\n body: any | null,\n options?: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'json';\n withCredentials?: boolean;\n },\n ): Observable;\n\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `PUT` request to execute on the server. The `PUT` method replaces an existing resource\n * with a new set of values.\n * See the individual overloads for details on the return type.\n */\n put(\n url: string,\n body: any | null,\n options: {\n headers?: HttpHeaders | {[header: string]: string | string[]};\n context?: HttpContext;\n observe?: 'body' | 'events' | 'response';\n params?:\n | HttpParams\n | {[param: string]: string | number | boolean | ReadonlyArray};\n reportProgress?: boolean;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n } = {},\n ): Observable {\n return this.request('PUT', url, addBody(options, body));\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {inject, Injectable, NgZone} from '@angular/core';\nimport {Observable, Observer} from 'rxjs';\n\nimport {HttpBackend} from './backend';\nimport {HttpHeaders} from './headers';\nimport {HttpRequest} from './request';\nimport {\n HttpDownloadProgressEvent,\n HttpErrorResponse,\n HttpEvent,\n HttpEventType,\n HttpHeaderResponse,\n HttpResponse,\n HttpStatusCode,\n} from './response';\n\nconst XSSI_PREFIX = /^\\)\\]\\}',?\\n/;\n\nconst REQUEST_URL_HEADER = `X-Request-URL`;\n\n/**\n * Determine an appropriate URL for the response, by checking either\n * response url or the X-Request-URL header.\n */\nfunction getResponseUrl(response: Response): string | null {\n if (response.url) {\n return response.url;\n }\n // stored as lowercase in the map\n const xRequestUrl = REQUEST_URL_HEADER.toLocaleLowerCase();\n return response.headers.get(xRequestUrl);\n}\n\n/**\n * Uses `fetch` to send requests to a backend server.\n *\n * This `FetchBackend` requires the support of the\n * [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) which is available on all\n * supported browsers and on Node.js v18 or later.\n *\n * @see {@link HttpHandler}\n *\n * @publicApi\n */\n@Injectable()\nexport class FetchBackend implements HttpBackend {\n // We need to bind the native fetch to its context or it will throw an \"illegal invocation\"\n private readonly fetchImpl =\n inject(FetchFactory, {optional: true})?.fetch ?? fetch.bind(globalThis);\n private readonly ngZone = inject(NgZone);\n\n handle(request: HttpRequest): Observable> {\n return new Observable((observer) => {\n const aborter = new AbortController();\n this.doRequest(request, aborter.signal, observer).then(noop, (error) =>\n observer.error(new HttpErrorResponse({error})),\n );\n return () => aborter.abort();\n });\n }\n\n private async doRequest(\n request: HttpRequest,\n signal: AbortSignal,\n observer: Observer>,\n ): Promise {\n const init = this.createRequestInit(request);\n let response;\n\n try {\n const fetchPromise = this.fetchImpl(request.urlWithParams, {signal, ...init});\n\n // Make sure Zone.js doesn't trigger false-positive unhandled promise\n // error in case the Promise is rejected synchronously. See function\n // description for additional information.\n silenceSuperfluousUnhandledPromiseRejection(fetchPromise);\n\n // Send the `Sent` event before awaiting the response.\n observer.next({type: HttpEventType.Sent});\n\n response = await fetchPromise;\n } catch (error: any) {\n observer.error(\n new HttpErrorResponse({\n error,\n status: error.status ?? 0,\n statusText: error.statusText,\n url: request.urlWithParams,\n headers: error.headers,\n }),\n );\n return;\n }\n\n const headers = new HttpHeaders(response.headers);\n const statusText = response.statusText;\n const url = getResponseUrl(response) ?? request.urlWithParams;\n\n let status = response.status;\n let body: string | ArrayBuffer | Blob | object | null = null;\n\n if (request.reportProgress) {\n observer.next(new HttpHeaderResponse({headers, status, statusText, url}));\n }\n\n if (response.body) {\n // Read Progress\n const contentLength = response.headers.get('content-length');\n const chunks: Uint8Array[] = [];\n const reader = response.body.getReader();\n let receivedLength = 0;\n\n let decoder: TextDecoder;\n let partialText: string | undefined;\n\n // We have to check whether the Zone is defined in the global scope because this may be called\n // when the zone is nooped.\n const reqZone = typeof Zone !== 'undefined' && Zone.current;\n\n // Perform response processing outside of Angular zone to\n // ensure no excessive change detection runs are executed\n // Here calling the async ReadableStreamDefaultReader.read() is responsible for triggering CD\n await this.ngZone.runOutsideAngular(async () => {\n while (true) {\n const {done, value} = await reader.read();\n\n if (done) {\n break;\n }\n\n chunks.push(value);\n receivedLength += value.length;\n\n if (request.reportProgress) {\n partialText =\n request.responseType === 'text'\n ? (partialText ?? '') +\n (decoder ??= new TextDecoder()).decode(value, {stream: true})\n : undefined;\n\n const reportProgress = () =>\n observer.next({\n type: HttpEventType.DownloadProgress,\n total: contentLength ? +contentLength : undefined,\n loaded: receivedLength,\n partialText,\n } as HttpDownloadProgressEvent);\n reqZone ? reqZone.run(reportProgress) : reportProgress();\n }\n }\n });\n\n // Combine all chunks.\n const chunksAll = this.concatChunks(chunks, receivedLength);\n try {\n const contentType = response.headers.get('Content-Type') ?? '';\n body = this.parseBody(request, chunksAll, contentType);\n } catch (error) {\n // Body loading or parsing failed\n observer.error(\n new HttpErrorResponse({\n error,\n headers: new HttpHeaders(response.headers),\n status: response.status,\n statusText: response.statusText,\n url: getResponseUrl(response) ?? request.urlWithParams,\n }),\n );\n return;\n }\n }\n\n // Same behavior as the XhrBackend\n if (status === 0) {\n status = body ? HttpStatusCode.Ok : 0;\n }\n\n // ok determines whether the response will be transmitted on the event or\n // error channel. Unsuccessful status codes (not 2xx) will always be errors,\n // but a successful status code can still result in an error if the user\n // asked for JSON data and the body cannot be parsed as such.\n const ok = status >= 200 && status < 300;\n\n if (ok) {\n observer.next(\n new HttpResponse({\n body,\n headers,\n status,\n statusText,\n url,\n }),\n );\n\n // The full body has been received and delivered, no further events\n // are possible. This request is complete.\n observer.complete();\n } else {\n observer.error(\n new HttpErrorResponse({\n error: body,\n headers,\n status,\n statusText,\n url,\n }),\n );\n }\n }\n\n private parseBody(\n request: HttpRequest,\n binContent: Uint8Array,\n contentType: string,\n ): string | ArrayBuffer | Blob | object | null {\n switch (request.responseType) {\n case 'json':\n // stripping the XSSI when present\n const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX, '');\n return text === '' ? null : (JSON.parse(text) as object);\n case 'text':\n return new TextDecoder().decode(binContent);\n case 'blob':\n return new Blob([binContent], {type: contentType});\n case 'arraybuffer':\n return binContent.buffer;\n }\n }\n\n private createRequestInit(req: HttpRequest): RequestInit {\n // We could share some of this logic with the XhrBackend\n\n const headers: Record = {};\n const credentials: RequestCredentials | undefined = req.withCredentials ? 'include' : undefined;\n\n // Setting all the requested headers.\n req.headers.forEach((name, values) => (headers[name] = values.join(',')));\n\n // Add an Accept header if one isn't present already.\n headers['Accept'] ??= 'application/json, text/plain, */*';\n\n // Auto-detect the Content-Type header if one isn't present already.\n if (!headers['Content-Type']) {\n const detectedType = req.detectContentTypeHeader();\n // Sometimes Content-Type detection fails.\n if (detectedType !== null) {\n headers['Content-Type'] = detectedType;\n }\n }\n\n return {\n body: req.serializeBody(),\n method: req.method,\n headers,\n credentials,\n };\n }\n\n private concatChunks(chunks: Uint8Array[], totalLength: number): Uint8Array {\n const chunksAll = new Uint8Array(totalLength);\n let position = 0;\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n\n return chunksAll;\n }\n}\n\n/**\n * Abstract class to provide a mocked implementation of `fetch()`\n */\nexport abstract class FetchFactory {\n abstract fetch: typeof fetch;\n}\n\nfunction noop(): void {}\n\n/**\n * Zone.js treats a rejected promise that has not yet been awaited\n * as an unhandled error. This function adds a noop `.then` to make\n * sure that Zone.js doesn't throw an error if the Promise is rejected\n * synchronously.\n */\nfunction silenceSuperfluousUnhandledPromiseRejection(promise: Promise) {\n promise.then(noop, noop);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {isPlatformServer} from '@angular/common';\nimport {\n EnvironmentInjector,\n inject,\n Injectable,\n InjectionToken,\n PLATFORM_ID,\n runInInjectionContext,\n ɵConsole as Console,\n ɵformatRuntimeError as formatRuntimeError,\n ɵPendingTasks as PendingTasks,\n} from '@angular/core';\nimport {Observable} from 'rxjs';\nimport {finalize} from 'rxjs/operators';\n\nimport {HttpBackend, HttpHandler} from './backend';\nimport {RuntimeErrorCode} from './errors';\nimport {FetchBackend} from './fetch';\nimport {HttpRequest} from './request';\nimport {HttpEvent} from './response';\n\n/**\n * Intercepts and handles an `HttpRequest` or `HttpResponse`.\n *\n * Most interceptors transform the outgoing request before passing it to the\n * next interceptor in the chain, by calling `next.handle(transformedReq)`.\n * An interceptor may transform the\n * response event stream as well, by applying additional RxJS operators on the stream\n * returned by `next.handle()`.\n *\n * More rarely, an interceptor may handle the request entirely,\n * and compose a new event stream instead of invoking `next.handle()`. This is an\n * acceptable behavior, but keep in mind that further interceptors will be skipped entirely.\n *\n * It is also rare but valid for an interceptor to return multiple responses on the\n * event stream for a single request.\n *\n * @publicApi\n *\n * @see [HTTP Guide](guide/http-intercept-requests-and-responses)\n * @see {@link HttpInterceptorFn}\n *\n * @usageNotes\n *\n * To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule`\n * only in your `AppModule`, and add the interceptors to the root application injector.\n * If you import `HttpClientModule` multiple times across different modules (for example, in lazy\n * loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the\n * interceptors provided in the root module.\n */\nexport interface HttpInterceptor {\n /**\n * Identifies and handles a given HTTP request.\n * @param req The outgoing request object to handle.\n * @param next The next interceptor in the chain, or the backend\n * if no interceptors remain in the chain.\n * @returns An observable of the event stream.\n */\n intercept(req: HttpRequest, next: HttpHandler): Observable>;\n}\n\n/**\n * Represents the next interceptor in an interceptor chain, or the real backend if there are no\n * further interceptors.\n *\n * Most interceptors will delegate to this function, and either modify the outgoing request or the\n * response when it arrives. Within the scope of the current request, however, this function may be\n * called any number of times, for any number of downstream requests. Such downstream requests need\n * not be to the same URL or even the same origin as the current request. It is also valid to not\n * call the downstream handler at all, and process the current request entirely within the\n * interceptor.\n *\n * This function should only be called within the scope of the request that's currently being\n * intercepted. Once that request is complete, this downstream handler function should not be\n * called.\n *\n * @publicApi\n *\n * @see [HTTP Guide](guide/http-intercept-requests-and-responses)\n */\nexport type HttpHandlerFn = (req: HttpRequest) => Observable>;\n\n/**\n * An interceptor for HTTP requests made via `HttpClient`.\n *\n * `HttpInterceptorFn`s are middleware functions which `HttpClient` calls when a request is made.\n * These functions have the opportunity to modify the outgoing request or any response that comes\n * back, as well as block, redirect, or otherwise change the request or response semantics.\n *\n * An `HttpHandlerFn` representing the next interceptor (or the backend which will make a real HTTP\n * request) is provided. Most interceptors will delegate to this function, but that is not required\n * (see `HttpHandlerFn` for more details).\n *\n * `HttpInterceptorFn`s are executed in an [injection context](/guide/dependency-injection-context).\n * They have access to `inject()` via the `EnvironmentInjector` from which they were configured.\n *\n * @see [HTTP Guide](guide/http-intercept-requests-and-responses)\n * @see {@link withInterceptors}\n *\n * @usageNotes\n * Here is a noop interceptor that passes the request through without modifying it:\n * ```typescript\n * export const noopInterceptor: HttpInterceptorFn = (req: HttpRequest, next:\n * HttpHandlerFn) => {\n * return next(modifiedReq);\n * };\n * ```\n *\n * If you want to alter a request, clone it first and modify the clone before passing it to the\n * `next()` handler function.\n *\n * Here is a basic interceptor that adds a bearer token to the headers\n * ```typescript\n * export const authenticationInterceptor: HttpInterceptorFn = (req: HttpRequest, next:\n * HttpHandlerFn) => {\n * const userToken = 'MY_TOKEN'; const modifiedReq = req.clone({\n * headers: req.headers.set('Authorization', `Bearer ${userToken}`),\n * });\n *\n * return next(modifiedReq);\n * };\n * ```\n */\nexport type HttpInterceptorFn = (\n req: HttpRequest,\n next: HttpHandlerFn,\n) => Observable>;\n\n/**\n * Function which invokes an HTTP interceptor chain.\n *\n * Each interceptor in the interceptor chain is turned into a `ChainedInterceptorFn` which closes\n * over the rest of the chain (represented by another `ChainedInterceptorFn`). The last such\n * function in the chain will instead delegate to the `finalHandlerFn`, which is passed down when\n * the chain is invoked.\n *\n * This pattern allows for a chain of many interceptors to be composed and wrapped in a single\n * `HttpInterceptorFn`, which is a useful abstraction for including different kinds of interceptors\n * (e.g. legacy class-based interceptors) in the same chain.\n */\ntype ChainedInterceptorFn = (\n req: HttpRequest,\n finalHandlerFn: HttpHandlerFn,\n) => Observable>;\n\nfunction interceptorChainEndFn(\n req: HttpRequest,\n finalHandlerFn: HttpHandlerFn,\n): Observable> {\n return finalHandlerFn(req);\n}\n\n/**\n * Constructs a `ChainedInterceptorFn` which adapts a legacy `HttpInterceptor` to the\n * `ChainedInterceptorFn` interface.\n */\nfunction adaptLegacyInterceptorToChain(\n chainTailFn: ChainedInterceptorFn,\n interceptor: HttpInterceptor,\n): ChainedInterceptorFn {\n return (initialRequest, finalHandlerFn) =>\n interceptor.intercept(initialRequest, {\n handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn),\n });\n}\n\n/**\n * Constructs a `ChainedInterceptorFn` which wraps and invokes a functional interceptor in the given\n * injector.\n */\nfunction chainedInterceptorFn(\n chainTailFn: ChainedInterceptorFn,\n interceptorFn: HttpInterceptorFn,\n injector: EnvironmentInjector,\n): ChainedInterceptorFn {\n // clang-format off\n return (initialRequest, finalHandlerFn) =>\n runInInjectionContext(injector, () =>\n interceptorFn(initialRequest, (downstreamRequest) =>\n chainTailFn(downstreamRequest, finalHandlerFn),\n ),\n );\n // clang-format on\n}\n\n/**\n * A multi-provider token that represents the array of registered\n * `HttpInterceptor` objects.\n *\n * @publicApi\n */\nexport const HTTP_INTERCEPTORS = new InjectionToken(\n ngDevMode ? 'HTTP_INTERCEPTORS' : '',\n);\n\n/**\n * A multi-provided token of `HttpInterceptorFn`s.\n */\nexport const HTTP_INTERCEPTOR_FNS = new InjectionToken(\n ngDevMode ? 'HTTP_INTERCEPTOR_FNS' : '',\n);\n\n/**\n * A multi-provided token of `HttpInterceptorFn`s that are only set in root.\n */\nexport const HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(\n ngDevMode ? 'HTTP_ROOT_INTERCEPTOR_FNS' : '',\n);\n\n/**\n * A provider to set a global primary http backend. If set, it will override the default one\n */\nexport const PRIMARY_HTTP_BACKEND = new InjectionToken(\n ngDevMode ? 'PRIMARY_HTTP_BACKEND' : '',\n);\n\n/**\n * Creates an `HttpInterceptorFn` which lazily initializes an interceptor chain from the legacy\n * class-based interceptors and runs the request through it.\n */\nexport function legacyInterceptorFnFactory(): HttpInterceptorFn {\n let chain: ChainedInterceptorFn | null = null;\n\n return (req, handler) => {\n if (chain === null) {\n const interceptors = inject(HTTP_INTERCEPTORS, {optional: true}) ?? [];\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `interceptors` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n chain = interceptors.reduceRight(\n adaptLegacyInterceptorToChain,\n interceptorChainEndFn as ChainedInterceptorFn,\n );\n }\n\n const pendingTasks = inject(PendingTasks);\n const taskId = pendingTasks.add();\n return chain(req, handler).pipe(finalize(() => pendingTasks.remove(taskId)));\n };\n}\n\nlet fetchBackendWarningDisplayed = false;\n\n/** Internal function to reset the flag in tests */\nexport function resetFetchBackendWarningFlag() {\n fetchBackendWarningDisplayed = false;\n}\n\n@Injectable()\nexport class HttpInterceptorHandler extends HttpHandler {\n private chain: ChainedInterceptorFn | null = null;\n private readonly pendingTasks = inject(PendingTasks);\n\n constructor(\n private backend: HttpBackend,\n private injector: EnvironmentInjector,\n ) {\n super();\n\n // Check if there is a preferred HTTP backend configured and use it if that's the case.\n // This is needed to enable `FetchBackend` globally for all HttpClient's when `withFetch`\n // is used.\n const primaryHttpBackend = inject(PRIMARY_HTTP_BACKEND, {optional: true});\n this.backend = primaryHttpBackend ?? backend;\n\n // We strongly recommend using fetch backend for HTTP calls when SSR is used\n // for an application. The logic below checks if that's the case and produces\n // a warning otherwise.\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !fetchBackendWarningDisplayed) {\n const isServer = isPlatformServer(injector.get(PLATFORM_ID));\n if (isServer && !(this.backend instanceof FetchBackend)) {\n fetchBackendWarningDisplayed = true;\n injector\n .get(Console)\n .warn(\n formatRuntimeError(\n RuntimeErrorCode.NOT_USING_FETCH_BACKEND_IN_SSR,\n 'Angular detected that `HttpClient` is not configured ' +\n \"to use `fetch` APIs. It's strongly recommended to \" +\n 'enable `fetch` for applications that use Server-Side Rendering ' +\n 'for better performance and compatibility. ' +\n 'To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` ' +\n 'call at the root of the application.',\n ),\n );\n }\n }\n }\n\n override handle(initialRequest: HttpRequest): Observable> {\n if (this.chain === null) {\n const dedupedInterceptorFns = Array.from(\n new Set([\n ...this.injector.get(HTTP_INTERCEPTOR_FNS),\n ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, []),\n ]),\n );\n\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `dedupedInterceptorFns` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n this.chain = dedupedInterceptorFns.reduceRight(\n (nextSequencedFn, interceptorFn) =>\n chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector),\n interceptorChainEndFn as ChainedInterceptorFn,\n );\n }\n\n const taskId = this.pendingTasks.add();\n return this.chain(initialRequest, (downstreamRequest) =>\n this.backend.handle(downstreamRequest),\n ).pipe(finalize(() => this.pendingTasks.remove(taskId)));\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {\n EnvironmentInjector,\n Inject,\n inject,\n Injectable,\n runInInjectionContext,\n} from '@angular/core';\nimport {Observable, Observer} from 'rxjs';\n\nimport {HttpBackend, HttpHandler} from './backend';\nimport {HttpHandlerFn} from './interceptor';\nimport {HttpRequest} from './request';\nimport {\n HttpErrorResponse,\n HttpEvent,\n HttpEventType,\n HttpResponse,\n HttpStatusCode,\n} from './response';\n\n// Every request made through JSONP needs a callback name that's unique across the\n// whole page. Each request is assigned an id and the callback name is constructed\n// from that. The next id to be assigned is tracked in a global variable here that\n// is shared among all applications on the page.\nlet nextRequestId: number = 0;\n\n/**\n * When a pending