@angular/common 20.1.0-next.3 → 20.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v20.1.0-next.3
2
+ * @license Angular v20.1.0
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, inject, NgZone, DestroyRef, PendingTasks, ɵConsole as _Console, ɵformatRuntimeError as _formatRuntimeError, runInInjectionContext, DOCUMENT, Inject, makeEnvironmentProviders, NgModule } from '@angular/core';
8
+ import { ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, inject, NgZone, DestroyRef, ɵformatRuntimeError as _formatRuntimeError, PendingTasks, ɵConsole as _Console, runInInjectionContext, DOCUMENT, Inject, makeEnvironmentProviders, NgModule } from '@angular/core';
9
9
  import { concatMap, filter, map, finalize, switchMap } from 'rxjs/operators';
10
10
  import { of, Observable, from } from 'rxjs';
11
11
  import { XhrFactory, parseCookieValue } from './xhr.mjs';
@@ -782,6 +782,11 @@ class HttpRequest {
782
782
  * Whether this request should be sent with outgoing credentials (cookies).
783
783
  */
784
784
  withCredentials = false;
785
+ /**
786
+ * The credentials mode of the request, which determines how cookies and HTTP authentication are handled.
787
+ * This can affect whether cookies are sent with the request, and how authentication is handled.
788
+ */
789
+ credentials;
785
790
  /**
786
791
  * When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
787
792
  */
@@ -795,6 +800,16 @@ class HttpRequest {
795
800
  * Indicates the relative priority of the request. This may be used by the browser to decide the order in which requests are dispatched and resources fetched.
796
801
  */
797
802
  priority;
803
+ /**
804
+ * The mode of the request, which determines how the request will interact with the browser's security model.
805
+ * This can affect things like CORS (Cross-Origin Resource Sharing) and same-origin policies.
806
+ */
807
+ mode;
808
+ /**
809
+ * The redirect mode of the request, which determines how redirects are handled.
810
+ * This can affect whether the request follows redirects automatically, or if it fails when a redirect occurs.
811
+ */
812
+ redirect;
798
813
  /**
799
814
  * The expected response type of the server.
800
815
  *
@@ -825,6 +840,10 @@ class HttpRequest {
825
840
  * The HttpTransferCache option for the request
826
841
  */
827
842
  transferCache;
843
+ /**
844
+ * The timeout for the backend HTTP request in ms.
845
+ */
846
+ timeout;
828
847
  constructor(method, url, third, fourth) {
829
848
  this.url = url;
830
849
  this.method = method.toUpperCase();
@@ -853,21 +872,38 @@ class HttpRequest {
853
872
  this.responseType = options.responseType;
854
873
  }
855
874
  // Override headers if they're provided.
856
- if (!!options.headers) {
875
+ if (options.headers) {
857
876
  this.headers = options.headers;
858
877
  }
859
- if (!!options.context) {
878
+ if (options.context) {
860
879
  this.context = options.context;
861
880
  }
862
- if (!!options.params) {
881
+ if (options.params) {
863
882
  this.params = options.params;
864
883
  }
865
- if (!!options.priority) {
884
+ if (options.priority) {
866
885
  this.priority = options.priority;
867
886
  }
868
- if (!!options.cache) {
887
+ if (options.cache) {
869
888
  this.cache = options.cache;
870
889
  }
890
+ if (options.credentials) {
891
+ this.credentials = options.credentials;
892
+ }
893
+ if (typeof options.timeout === 'number') {
894
+ // XHR will ignore any value below 1. AbortSignals only accept unsigned integers.
895
+ if (options.timeout < 1 || !Number.isInteger(options.timeout)) {
896
+ // TODO: create a runtime error
897
+ throw new Error(ngDevMode ? '`timeout` must be a positive integer value' : '');
898
+ }
899
+ this.timeout = options.timeout;
900
+ }
901
+ if (options.mode) {
902
+ this.mode = options.mode;
903
+ }
904
+ if (options.redirect) {
905
+ this.redirect = options.redirect;
906
+ }
871
907
  // We do want to assign transferCache even if it's falsy (false is valid value)
872
908
  this.transferCache = options.transferCache;
873
909
  }
@@ -984,9 +1020,13 @@ class HttpRequest {
984
1020
  const keepalive = update.keepalive ?? this.keepalive;
985
1021
  const priority = update.priority || this.priority;
986
1022
  const cache = update.cache || this.cache;
1023
+ const mode = update.mode || this.mode;
1024
+ const redirect = update.redirect || this.redirect;
1025
+ const credentials = update.credentials || this.credentials;
987
1026
  // Carefully handle the transferCache to differentiate between
988
1027
  // `false` and `undefined` in the update args.
989
1028
  const transferCache = update.transferCache ?? this.transferCache;
1029
+ const timeout = update.timeout ?? this.timeout;
990
1030
  // The body is somewhat special - a `null` value in update.body means
991
1031
  // whatever current body is present is being overridden with an empty
992
1032
  // body, whereas an `undefined` value in update.body implies no
@@ -1024,6 +1064,10 @@ class HttpRequest {
1024
1064
  keepalive,
1025
1065
  cache,
1026
1066
  priority,
1067
+ timeout,
1068
+ mode,
1069
+ redirect,
1070
+ credentials,
1027
1071
  });
1028
1072
  }
1029
1073
  }
@@ -1313,6 +1357,8 @@ function addBody(options, body) {
1313
1357
  keepalive: options.keepalive,
1314
1358
  priority: options.priority,
1315
1359
  cache: options.cache,
1360
+ mode: options.mode,
1361
+ redirect: options.redirect,
1316
1362
  };
1317
1363
  }
1318
1364
  /**
@@ -1442,6 +1488,9 @@ class HttpClient {
1442
1488
  keepalive: options.keepalive,
1443
1489
  priority: options.priority,
1444
1490
  cache: options.cache,
1491
+ mode: options.mode,
1492
+ redirect: options.redirect,
1493
+ credentials: options.credentials,
1445
1494
  });
1446
1495
  }
1447
1496
  // Start with an Observable.of() the initial request, and run the handler (which
@@ -1596,10 +1645,10 @@ class HttpClient {
1596
1645
  put(url, body, options = {}) {
1597
1646
  return this.request('PUT', url, addBody(options, body));
1598
1647
  }
1599
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
1600
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClient });
1648
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
1649
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClient });
1601
1650
  }
1602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClient, decorators: [{
1651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClient, decorators: [{
1603
1652
  type: Injectable
1604
1653
  }], ctorParameters: () => [{ type: HttpHandler }] });
1605
1654
 
@@ -1649,7 +1698,22 @@ class FetchBackend {
1649
1698
  return new Observable((observer) => {
1650
1699
  const aborter = new AbortController();
1651
1700
  this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({ error })));
1652
- return () => aborter.abort();
1701
+ let timeoutId;
1702
+ if (request.timeout) {
1703
+ // TODO: Replace with AbortSignal.any([aborter.signal, AbortSignal.timeout(request.timeout)])
1704
+ // when AbortSignal.any support is Baseline widely available (NET nov. 2026)
1705
+ timeoutId = this.ngZone.runOutsideAngular(() => setTimeout(() => {
1706
+ if (!aborter.signal.aborted) {
1707
+ aborter.abort(new DOMException('signal timed out', 'TimeoutError'));
1708
+ }
1709
+ }, request.timeout));
1710
+ }
1711
+ return () => {
1712
+ if (timeoutId !== undefined) {
1713
+ clearTimeout(timeoutId);
1714
+ }
1715
+ aborter.abort();
1716
+ };
1653
1717
  });
1654
1718
  }
1655
1719
  async doRequest(request, signal, observer) {
@@ -1812,7 +1876,16 @@ class FetchBackend {
1812
1876
  createRequestInit(req) {
1813
1877
  // We could share some of this logic with the XhrBackend
1814
1878
  const headers = {};
1815
- const credentials = req.withCredentials ? 'include' : undefined;
1879
+ let credentials;
1880
+ // If the request has a credentials property, use it.
1881
+ // Otherwise, if the request has withCredentials set to true, use 'include'.
1882
+ credentials = req.credentials;
1883
+ // If withCredentials is true should be set to 'include', for compatibility
1884
+ if (req.withCredentials) {
1885
+ // A warning is logged in development mode if the request has both
1886
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warningOptionsMessage(req);
1887
+ credentials = 'include';
1888
+ }
1816
1889
  // Setting all the requested headers.
1817
1890
  req.headers.forEach((name, values) => (headers[name] = values.join(',')));
1818
1891
  // Add an Accept header if one isn't present already.
@@ -1835,6 +1908,8 @@ class FetchBackend {
1835
1908
  keepalive: req.keepalive,
1836
1909
  cache: req.cache,
1837
1910
  priority: req.priority,
1911
+ mode: req.mode,
1912
+ redirect: req.redirect,
1838
1913
  };
1839
1914
  }
1840
1915
  concatChunks(chunks, totalLength) {
@@ -1846,10 +1921,10 @@ class FetchBackend {
1846
1921
  }
1847
1922
  return chunksAll;
1848
1923
  }
1849
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1850
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: FetchBackend });
1924
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1925
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FetchBackend });
1851
1926
  }
1852
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: FetchBackend, decorators: [{
1927
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: FetchBackend, decorators: [{
1853
1928
  type: Injectable
1854
1929
  }], ctorParameters: () => [] });
1855
1930
  /**
@@ -1858,6 +1933,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3",
1858
1933
  class FetchFactory {
1859
1934
  }
1860
1935
  function noop() { }
1936
+ function warningOptionsMessage(req) {
1937
+ if (req.credentials && req.withCredentials) {
1938
+ console.warn(_formatRuntimeError(2819 /* RuntimeErrorCode.WITH_CREDENTIALS_OVERRIDES_EXPLICIT_CREDENTIALS */, `Angular detected that a \`HttpClient\` request has both \`withCredentials: true\` and \`credentials: '${req.credentials}'\` options. The \`withCredentials\` option is overriding the explicit \`credentials\` setting to 'include'. Consider removing \`withCredentials\` and using \`credentials: '${req.credentials}'\` directly for clarity.`));
1939
+ }
1940
+ }
1861
1941
  /**
1862
1942
  * Zone.js treats a rejected promise that has not yet been awaited
1863
1943
  * as an unhandled error. This function adds a noop `.then` to make
@@ -1988,10 +2068,10 @@ class HttpInterceptorHandler extends HttpHandler {
1988
2068
  return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
1989
2069
  }
1990
2070
  }
1991
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
1992
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpInterceptorHandler });
2071
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2072
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpInterceptorHandler });
1993
2073
  }
1994
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
2074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
1995
2075
  type: Injectable
1996
2076
  }], ctorParameters: () => [{ type: HttpBackend }, { type: i0.EnvironmentInjector }] });
1997
2077
 
@@ -2193,10 +2273,10 @@ class JsonpClientBackend {
2193
2273
  foreignDocument ??= this.document.implementation.createHTMLDocument();
2194
2274
  foreignDocument.adoptNode(script);
2195
2275
  }
2196
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
2197
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpClientBackend });
2276
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
2277
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpClientBackend });
2198
2278
  }
2199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpClientBackend, decorators: [{
2279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpClientBackend, decorators: [{
2200
2280
  type: Injectable
2201
2281
  }], ctorParameters: () => [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
2202
2282
  type: Inject,
@@ -2235,10 +2315,10 @@ class JsonpInterceptor {
2235
2315
  intercept(initialRequest, next) {
2236
2316
  return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
2237
2317
  }
2238
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2239
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpInterceptor });
2318
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2319
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpInterceptor });
2240
2320
  }
2241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: JsonpInterceptor, decorators: [{
2321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: JsonpInterceptor, decorators: [{
2242
2322
  type: Injectable
2243
2323
  }], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
2244
2324
 
@@ -2257,6 +2337,44 @@ function getResponseUrl(xhr) {
2257
2337
  }
2258
2338
  return null;
2259
2339
  }
2340
+ /**
2341
+ * Validates whether the request is compatible with the XHR backend.
2342
+ * Show a warning if the request contains options that are not supported by XHR.
2343
+ */
2344
+ function validateXhrCompatibility(req) {
2345
+ const unsupportedOptions = [
2346
+ {
2347
+ property: 'keepalive',
2348
+ errorCode: 2813 /* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */,
2349
+ },
2350
+ {
2351
+ property: 'cache',
2352
+ errorCode: 2814 /* RuntimeErrorCode.CACHE_NOT_SUPPORTED_WITH_XHR */,
2353
+ },
2354
+ {
2355
+ property: 'priority',
2356
+ errorCode: 2815 /* RuntimeErrorCode.PRIORITY_NOT_SUPPORTED_WITH_XHR */,
2357
+ },
2358
+ {
2359
+ property: 'mode',
2360
+ errorCode: 2816 /* RuntimeErrorCode.MODE_NOT_SUPPORTED_WITH_XHR */,
2361
+ },
2362
+ {
2363
+ property: 'redirect',
2364
+ errorCode: 2817 /* RuntimeErrorCode.REDIRECT_NOT_SUPPORTED_WITH_XHR */,
2365
+ },
2366
+ {
2367
+ property: 'credentials',
2368
+ errorCode: 2818 /* RuntimeErrorCode.CREDENTIALS_NOT_SUPPORTED_WITH_XHR */,
2369
+ },
2370
+ ];
2371
+ // Check each unsupported option and warn if present
2372
+ for (const { property, errorCode } of unsupportedOptions) {
2373
+ if (property in req) {
2374
+ console.warn(_formatRuntimeError(errorCode, `Angular detected that a \`HttpClient\` request with the \`${property}\` option was sent using XHR, which does not support it. To use the \`${property}\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2375
+ }
2376
+ }
2377
+ }
2260
2378
  /**
2261
2379
  * Uses `XMLHttpRequest` to send requests to a backend server.
2262
2380
  * @see {@link HttpHandler}
@@ -2281,20 +2399,19 @@ class HttpXhrBackend {
2281
2399
  throw new _RuntimeError(-2800 /* RuntimeErrorCode.MISSING_JSONP_MODULE */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
2282
2400
  `Cannot make a JSONP request without JSONP support. To fix the problem, either add the \`withJsonpSupport()\` call (if \`provideHttpClient()\` is used) or import the \`HttpClientJsonpModule\` in the root NgModule.`);
2283
2401
  }
2284
- if (req.keepalive && ngDevMode) {
2285
- console.warn(_formatRuntimeError(2813 /* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */, `Angular detected that a \`HttpClient\` request with the \`keepalive\` option was sent using XHR, which does not support it. To use the \`keepalive\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2286
- }
2287
- if (req.cache && ngDevMode) {
2288
- console.warn(_formatRuntimeError(2814 /* RuntimeErrorCode.CACHE_NOT_SUPPORTED_WITH_XHR */, `Angular detected that a \`HttpClient\` request with the \`cache\` option was sent using XHR, which does not support it. To use the \`cache\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2289
- }
2290
- if (req.priority && ngDevMode) {
2291
- console.warn(_formatRuntimeError(2815 /* RuntimeErrorCode.PRIORITY_NOT_SUPPORTED_WITH_XHR */, `Angular detected that a \`HttpClient\` request with the \`priority\` option was sent using XHR, which does not support it. To use the \`priority\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2292
- }
2402
+ // Validate that the request is compatible with the XHR backend.
2403
+ ngDevMode && validateXhrCompatibility(req);
2293
2404
  // Check whether this factory has a special function to load an XHR implementation
2294
2405
  // for various non-browser environments. We currently limit it to only `ServerXhr`
2295
2406
  // class, which needs to load an XHR implementation.
2296
2407
  const xhrFactory = this.xhrFactory;
2297
- const source = xhrFactory.ɵloadImpl
2408
+ const source =
2409
+ // Note that `ɵloadImpl` is never defined in client bundles and can be
2410
+ // safely dropped whenever we're running in the browser.
2411
+ // This branching is redundant.
2412
+ // The `ngServerMode` guard also enables tree-shaking of the `from()`
2413
+ // function from the common bundle, as it's only used in server code.
2414
+ typeof ngServerMode !== 'undefined' && ngServerMode && xhrFactory.ɵloadImpl
2298
2415
  ? from(xhrFactory.ɵloadImpl())
2299
2416
  : of(null);
2300
2417
  return source.pipe(switchMap(() => {
@@ -2321,6 +2438,9 @@ class HttpXhrBackend {
2321
2438
  xhr.setRequestHeader(CONTENT_TYPE_HEADER, detectedType);
2322
2439
  }
2323
2440
  }
2441
+ if (req.timeout) {
2442
+ xhr.timeout = req.timeout;
2443
+ }
2324
2444
  // Set the responseType if one was requested.
2325
2445
  if (req.responseType) {
2326
2446
  const responseType = req.responseType.toLowerCase();
@@ -2441,6 +2561,19 @@ class HttpXhrBackend {
2441
2561
  });
2442
2562
  observer.error(res);
2443
2563
  };
2564
+ let onTimeout = onError;
2565
+ if (req.timeout) {
2566
+ onTimeout = (_) => {
2567
+ const { url } = partialFromXhr();
2568
+ const res = new HttpErrorResponse({
2569
+ error: new DOMException('Request timed out', 'TimeoutError'),
2570
+ status: xhr.status || 0,
2571
+ statusText: xhr.statusText || 'Request timeout',
2572
+ url: url || undefined,
2573
+ });
2574
+ observer.error(res);
2575
+ };
2576
+ }
2444
2577
  // The sentHeaders flag tracks whether the HttpResponseHeaders event
2445
2578
  // has been sent on the stream. This is necessary to track if progress
2446
2579
  // is enabled since the event will be sent on only the first download
@@ -2493,7 +2626,7 @@ class HttpXhrBackend {
2493
2626
  // By default, register for load and error events.
2494
2627
  xhr.addEventListener('load', onLoad);
2495
2628
  xhr.addEventListener('error', onError);
2496
- xhr.addEventListener('timeout', onError);
2629
+ xhr.addEventListener('timeout', onTimeout);
2497
2630
  xhr.addEventListener('abort', onError);
2498
2631
  // Progress events are only enabled if requested.
2499
2632
  if (req.reportProgress) {
@@ -2514,7 +2647,7 @@ class HttpXhrBackend {
2514
2647
  xhr.removeEventListener('error', onError);
2515
2648
  xhr.removeEventListener('abort', onError);
2516
2649
  xhr.removeEventListener('load', onLoad);
2517
- xhr.removeEventListener('timeout', onError);
2650
+ xhr.removeEventListener('timeout', onTimeout);
2518
2651
  if (req.reportProgress) {
2519
2652
  xhr.removeEventListener('progress', onDownProgress);
2520
2653
  if (reqBody !== null && xhr.upload) {
@@ -2529,10 +2662,10 @@ class HttpXhrBackend {
2529
2662
  });
2530
2663
  }));
2531
2664
  }
2532
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXhrBackend, deps: [{ token: XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
2533
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXhrBackend });
2665
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXhrBackend, deps: [{ token: XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
2666
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXhrBackend });
2534
2667
  }
2535
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXhrBackend, decorators: [{
2668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXhrBackend, decorators: [{
2536
2669
  type: Injectable
2537
2670
  }], ctorParameters: () => [{ type: XhrFactory }] });
2538
2671
 
@@ -2582,10 +2715,10 @@ class HttpXsrfCookieExtractor {
2582
2715
  }
2583
2716
  return this.lastToken;
2584
2717
  }
2585
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
2586
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfCookieExtractor });
2718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
2719
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfCookieExtractor });
2587
2720
  }
2588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
2721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
2589
2722
  type: Injectable
2590
2723
  }], ctorParameters: () => [{ type: undefined, decorators: [{
2591
2724
  type: Inject,
@@ -2626,10 +2759,10 @@ class HttpXsrfInterceptor {
2626
2759
  intercept(initialRequest, next) {
2627
2760
  return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
2628
2761
  }
2629
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2630
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfInterceptor });
2762
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2763
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfInterceptor });
2631
2764
  }
2632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
2765
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
2633
2766
  type: Injectable
2634
2767
  }], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
2635
2768
 
@@ -2895,9 +3028,9 @@ class HttpClientXsrfModule {
2895
3028
  providers: withXsrfConfiguration(options).ɵproviders,
2896
3029
  };
2897
3030
  }
2898
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2899
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientXsrfModule });
2900
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientXsrfModule, providers: [
3031
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3032
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: HttpClientXsrfModule });
3033
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientXsrfModule, providers: [
2901
3034
  HttpXsrfInterceptor,
2902
3035
  { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
2903
3036
  { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
@@ -2908,7 +3041,7 @@ class HttpClientXsrfModule {
2908
3041
  { provide: XSRF_ENABLED, useValue: true },
2909
3042
  ] });
2910
3043
  }
2911
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
3044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
2912
3045
  type: NgModule,
2913
3046
  args: [{
2914
3047
  providers: [
@@ -2934,11 +3067,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3",
2934
3067
  * @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
2935
3068
  */
2936
3069
  class HttpClientModule {
2937
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2938
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientModule });
2939
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] });
3070
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3071
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: HttpClientModule });
3072
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] });
2940
3073
  }
2941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientModule, decorators: [{
3074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientModule, decorators: [{
2942
3075
  type: NgModule,
2943
3076
  args: [{
2944
3077
  /**
@@ -2958,11 +3091,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3",
2958
3091
  * @deprecated `withJsonpSupport()` as providers instead
2959
3092
  */
2960
3093
  class HttpClientJsonpModule {
2961
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2962
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientJsonpModule });
2963
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] });
3094
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3095
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: HttpClientJsonpModule });
3096
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] });
2964
3097
  }
2965
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.3", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
3098
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
2966
3099
  type: NgModule,
2967
3100
  args: [{
2968
3101
  providers: [withJsonpSupport().ɵproviders],