@angular/common 15.0.0-next.5 → 15.0.0-next.6
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.
- package/esm2020/http/public_api.mjs +6 -3
- package/esm2020/http/src/backend.mjs +1 -1
- package/esm2020/http/src/client.mjs +3 -3
- package/esm2020/http/src/interceptor.mjs +65 -20
- package/esm2020/http/src/jsonp.mjs +38 -18
- package/esm2020/http/src/module.mjs +40 -116
- package/esm2020/http/src/provider.mjs +129 -0
- package/esm2020/http/src/xhr.mjs +3 -3
- package/esm2020/http/src/xsrf.mjs +42 -33
- package/esm2020/http/testing/public_api.mjs +2 -1
- package/esm2020/http/testing/src/backend.mjs +3 -3
- package/esm2020/http/testing/src/module.mjs +9 -14
- package/esm2020/http/testing/src/provider.mjs +18 -0
- package/esm2020/src/common.mjs +2 -2
- package/esm2020/src/common_module.mjs +4 -4
- package/esm2020/src/directives/ng_class.mjs +3 -3
- package/esm2020/src/directives/ng_component_outlet.mjs +3 -3
- package/esm2020/src/directives/ng_for_of.mjs +3 -3
- package/esm2020/src/directives/ng_if.mjs +3 -3
- package/esm2020/src/directives/ng_optimized_image/lcp_image_observer.mjs +3 -3
- package/esm2020/src/directives/ng_optimized_image/ng_optimized_image.mjs +156 -11
- package/esm2020/src/directives/ng_optimized_image/preconnect_link_checker.mjs +3 -3
- package/esm2020/src/directives/ng_optimized_image/preload-link-creator.mjs +74 -0
- package/esm2020/src/directives/ng_optimized_image/tokens.mjs +24 -0
- package/esm2020/src/directives/ng_plural.mjs +6 -6
- package/esm2020/src/directives/ng_style.mjs +3 -3
- package/esm2020/src/directives/ng_switch.mjs +9 -9
- package/esm2020/src/directives/ng_template_outlet.mjs +3 -3
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/i18n/localization.mjs +6 -6
- package/esm2020/src/location/hash_location_strategy.mjs +3 -3
- package/esm2020/src/location/location.mjs +3 -3
- package/esm2020/src/location/location_strategy.mjs +6 -6
- package/esm2020/src/location/platform_location.mjs +6 -6
- package/esm2020/src/pipes/async_pipe.mjs +3 -3
- package/esm2020/src/pipes/case_conversion_pipes.mjs +9 -9
- package/esm2020/src/pipes/date_pipe.mjs +50 -7
- package/esm2020/src/pipes/date_pipe_config.mjs +13 -0
- package/esm2020/src/pipes/i18n_plural_pipe.mjs +3 -3
- package/esm2020/src/pipes/i18n_select_pipe.mjs +3 -3
- package/esm2020/src/pipes/index.mjs +3 -3
- package/esm2020/src/pipes/json_pipe.mjs +3 -3
- package/esm2020/src/pipes/keyvalue_pipe.mjs +3 -3
- package/esm2020/src/pipes/number_pipe.mjs +9 -9
- package/esm2020/src/pipes/slice_pipe.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/location_mock.mjs +3 -3
- package/esm2020/testing/src/mock_location_strategy.mjs +3 -3
- package/esm2020/testing/src/mock_platform_location.mjs +3 -3
- package/esm2020/testing/src/provide_location_mocks.mjs +24 -0
- package/esm2020/testing/src/testing.mjs +2 -1
- package/esm2020/upgrade/src/location_upgrade_module.mjs +4 -4
- package/fesm2015/common.mjs +415 -123
- package/fesm2015/common.mjs.map +1 -1
- package/fesm2015/http/testing.mjs +27 -16
- package/fesm2015/http/testing.mjs.map +1 -1
- package/fesm2015/http.mjs +295 -174
- package/fesm2015/http.mjs.map +1 -1
- package/fesm2015/testing.mjs +33 -12
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/upgrade.mjs +5 -5
- package/fesm2020/common.mjs +413 -122
- package/fesm2020/common.mjs.map +1 -1
- package/fesm2020/http/testing.mjs +27 -16
- package/fesm2020/http/testing.mjs.map +1 -1
- package/fesm2020/http.mjs +294 -172
- package/fesm2020/http.mjs.map +1 -1
- package/fesm2020/testing.mjs +33 -12
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/upgrade.mjs +5 -5
- package/http/index.d.ts +87 -30
- package/http/testing/index.d.ts +4 -1
- package/index.d.ts +89 -7
- package/package.json +3 -3
- package/testing/index.d.ts +11 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/http.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.0-next.
|
|
2
|
+
* @license Angular v15.0.0-next.6
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
8
8
|
import { DOCUMENT, ɵparseCookieValue, XhrFactory as XhrFactory$1 } from '@angular/common';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
|
-
import { Injectable, InjectionToken, Inject, PLATFORM_ID, NgModule } from '@angular/core';
|
|
10
|
+
import { Injectable, InjectionToken, inject, Inject, PLATFORM_ID, NgModule } from '@angular/core';
|
|
11
11
|
import { of, Observable } from 'rxjs';
|
|
12
12
|
import { concatMap, filter, map } from 'rxjs/operators';
|
|
13
13
|
|
|
@@ -1415,9 +1415,9 @@ class HttpClient {
|
|
|
1415
1415
|
return this.request('PUT', url, addBody(options, body));
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
HttpClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1419
|
-
HttpClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1420
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1418
|
+
HttpClient.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1419
|
+
HttpClient.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClient });
|
|
1420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClient, decorators: [{
|
|
1421
1421
|
type: Injectable
|
|
1422
1422
|
}], ctorParameters: function () { return [{ type: HttpHandler }]; } });
|
|
1423
1423
|
|
|
@@ -1428,19 +1428,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
1428
1428
|
* Use of this source code is governed by an MIT-style license that can be
|
|
1429
1429
|
* found in the LICENSE file at https://angular.io/license
|
|
1430
1430
|
*/
|
|
1431
|
+
function interceptorChainEndFn(req, finalHandlerFn) {
|
|
1432
|
+
return finalHandlerFn(req);
|
|
1433
|
+
}
|
|
1431
1434
|
/**
|
|
1432
|
-
* `
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1435
|
+
* Constructs a `ChainedInterceptorFn` which adapts a legacy `HttpInterceptor` to the
|
|
1436
|
+
* `ChainedInterceptorFn` interface.
|
|
1435
1437
|
*/
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1438
|
+
function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
|
|
1439
|
+
return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {
|
|
1440
|
+
handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn),
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Constructs a `ChainedInterceptorFn` which wraps and invokes a functional interceptor in the given
|
|
1445
|
+
* injector.
|
|
1446
|
+
*/
|
|
1447
|
+
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
|
|
1448
|
+
// clang-format off
|
|
1449
|
+
return (initialRequest, finalHandlerFn) => injector.runInContext(() => interceptorFn(initialRequest, downstreamRequest => chainTailFn(downstreamRequest, finalHandlerFn)));
|
|
1450
|
+
// clang-format on
|
|
1444
1451
|
}
|
|
1445
1452
|
/**
|
|
1446
1453
|
* A multi-provider token that represents the array of registered
|
|
@@ -1449,16 +1456,52 @@ class HttpInterceptorHandler {
|
|
|
1449
1456
|
* @publicApi
|
|
1450
1457
|
*/
|
|
1451
1458
|
const HTTP_INTERCEPTORS = new InjectionToken('HTTP_INTERCEPTORS');
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1459
|
+
/**
|
|
1460
|
+
* A multi-provided token of `HttpInterceptorFn`s.
|
|
1461
|
+
*/
|
|
1462
|
+
const HTTP_INTERCEPTOR_FNS = new InjectionToken('HTTP_INTERCEPTOR_FNS');
|
|
1463
|
+
/**
|
|
1464
|
+
* Creates an `HttpInterceptorFn` which lazily initializes an interceptor chain from the legacy
|
|
1465
|
+
* class-based interceptors and runs the request through it.
|
|
1466
|
+
*/
|
|
1467
|
+
function legacyInterceptorFnFactory() {
|
|
1468
|
+
let chain = null;
|
|
1469
|
+
return (req, handler) => {
|
|
1470
|
+
if (chain === null) {
|
|
1471
|
+
const interceptors = inject(HTTP_INTERCEPTORS, { optional: true }) ?? [];
|
|
1472
|
+
// Note: interceptors are wrapped right-to-left so that final execution order is
|
|
1473
|
+
// left-to-right. That is, if `interceptors` is the array `[a, b, c]`, we want to
|
|
1474
|
+
// produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside
|
|
1475
|
+
// out.
|
|
1476
|
+
chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);
|
|
1477
|
+
}
|
|
1478
|
+
return chain(req, handler);
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
class HttpInterceptorHandler extends HttpHandler {
|
|
1482
|
+
constructor(backend, injector) {
|
|
1483
|
+
super();
|
|
1484
|
+
this.backend = backend;
|
|
1485
|
+
this.injector = injector;
|
|
1486
|
+
this.chain = null;
|
|
1487
|
+
}
|
|
1488
|
+
handle(initialRequest) {
|
|
1489
|
+
if (this.chain === null) {
|
|
1490
|
+
const dedupedInterceptorFns = Array.from(new Set(this.injector.get(HTTP_INTERCEPTOR_FNS)));
|
|
1491
|
+
// Note: interceptors are wrapped right-to-left so that final execution order is
|
|
1492
|
+
// left-to-right. That is, if `dedupedInterceptorFns` is the array `[a, b, c]`, we want to
|
|
1493
|
+
// produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside
|
|
1494
|
+
// out.
|
|
1495
|
+
this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
|
|
1496
|
+
}
|
|
1497
|
+
return this.chain(initialRequest, downstreamRequest => this.backend.handle(downstreamRequest));
|
|
1455
1498
|
}
|
|
1456
1499
|
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1500
|
+
HttpInterceptorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1501
|
+
HttpInterceptorHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpInterceptorHandler });
|
|
1502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
|
|
1460
1503
|
type: Injectable
|
|
1461
|
-
}] });
|
|
1504
|
+
}], ctorParameters: function () { return [{ type: HttpBackend }, { type: i0.EnvironmentInjector }]; } });
|
|
1462
1505
|
|
|
1463
1506
|
/**
|
|
1464
1507
|
* @license
|
|
@@ -1496,6 +1539,20 @@ const JSONP_ERR_HEADERS_NOT_SUPPORTED = 'JSONP requests do not support headers.'
|
|
|
1496
1539
|
*/
|
|
1497
1540
|
class JsonpCallbackContext {
|
|
1498
1541
|
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Factory function that determines where to store JSONP callbacks.
|
|
1544
|
+
*
|
|
1545
|
+
* Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist
|
|
1546
|
+
* in test environments. In that case, callbacks are stored on an anonymous object instead.
|
|
1547
|
+
*
|
|
1548
|
+
*
|
|
1549
|
+
*/
|
|
1550
|
+
function jsonpCallbackContext() {
|
|
1551
|
+
if (typeof window === 'object') {
|
|
1552
|
+
return window;
|
|
1553
|
+
}
|
|
1554
|
+
return {};
|
|
1555
|
+
}
|
|
1499
1556
|
/**
|
|
1500
1557
|
* Processes an `HttpRequest` with the JSONP method,
|
|
1501
1558
|
* by performing JSONP style requests.
|
|
@@ -1652,14 +1709,24 @@ class JsonpClientBackend {
|
|
|
1652
1709
|
foreignDocument.adoptNode(script);
|
|
1653
1710
|
}
|
|
1654
1711
|
}
|
|
1655
|
-
JsonpClientBackend.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1656
|
-
JsonpClientBackend.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1657
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1712
|
+
JsonpClientBackend.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1713
|
+
JsonpClientBackend.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpClientBackend });
|
|
1714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpClientBackend, decorators: [{
|
|
1658
1715
|
type: Injectable
|
|
1659
1716
|
}], ctorParameters: function () { return [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
|
|
1660
1717
|
type: Inject,
|
|
1661
1718
|
args: [DOCUMENT]
|
|
1662
1719
|
}] }]; } });
|
|
1720
|
+
/**
|
|
1721
|
+
* Identifies requests with the method JSONP and shifts them to the `JsonpClientBackend`.
|
|
1722
|
+
*/
|
|
1723
|
+
function jsonpInterceptorFn(req, next) {
|
|
1724
|
+
if (req.method === 'JSONP') {
|
|
1725
|
+
return inject(JsonpClientBackend).handle(req);
|
|
1726
|
+
}
|
|
1727
|
+
// Fall through for normal HTTP requests.
|
|
1728
|
+
return next(req);
|
|
1729
|
+
}
|
|
1663
1730
|
/**
|
|
1664
1731
|
* Identifies requests with the method JSONP and
|
|
1665
1732
|
* shifts them to the `JsonpClientBackend`.
|
|
@@ -1669,29 +1736,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
1669
1736
|
* @publicApi
|
|
1670
1737
|
*/
|
|
1671
1738
|
class JsonpInterceptor {
|
|
1672
|
-
constructor(
|
|
1673
|
-
this.
|
|
1739
|
+
constructor(injector) {
|
|
1740
|
+
this.injector = injector;
|
|
1674
1741
|
}
|
|
1675
1742
|
/**
|
|
1676
1743
|
* Identifies and handles a given JSONP request.
|
|
1677
|
-
* @param
|
|
1744
|
+
* @param initialRequest The outgoing request object to handle.
|
|
1678
1745
|
* @param next The next interceptor in the chain, or the backend
|
|
1679
1746
|
* if no interceptors remain in the chain.
|
|
1680
1747
|
* @returns An observable of the event stream.
|
|
1681
1748
|
*/
|
|
1682
|
-
intercept(
|
|
1683
|
-
|
|
1684
|
-
return this.jsonp.handle(req);
|
|
1685
|
-
}
|
|
1686
|
-
// Fall through for normal HTTP requests.
|
|
1687
|
-
return next.handle(req);
|
|
1749
|
+
intercept(initialRequest, next) {
|
|
1750
|
+
return this.injector.runInContext(() => jsonpInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
1688
1751
|
}
|
|
1689
1752
|
}
|
|
1690
|
-
JsonpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1691
|
-
JsonpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1692
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1753
|
+
JsonpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1754
|
+
JsonpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpInterceptor });
|
|
1755
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: JsonpInterceptor, decorators: [{
|
|
1693
1756
|
type: Injectable
|
|
1694
|
-
}], ctorParameters: function () { return [{ type:
|
|
1757
|
+
}], ctorParameters: function () { return [{ type: i0.EnvironmentInjector }]; } });
|
|
1695
1758
|
|
|
1696
1759
|
/**
|
|
1697
1760
|
* @license
|
|
@@ -1965,9 +2028,9 @@ class HttpXhrBackend {
|
|
|
1965
2028
|
});
|
|
1966
2029
|
}
|
|
1967
2030
|
}
|
|
1968
|
-
HttpXhrBackend.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1969
|
-
HttpXhrBackend.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
1970
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2031
|
+
HttpXhrBackend.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXhrBackend, deps: [{ token: i1.XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2032
|
+
HttpXhrBackend.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXhrBackend });
|
|
2033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXhrBackend, decorators: [{
|
|
1971
2034
|
type: Injectable
|
|
1972
2035
|
}], ctorParameters: function () { return [{ type: i1.XhrFactory }]; } });
|
|
1973
2036
|
|
|
@@ -1978,8 +2041,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
1978
2041
|
* Use of this source code is governed by an MIT-style license that can be
|
|
1979
2042
|
* found in the LICENSE file at https://angular.io/license
|
|
1980
2043
|
*/
|
|
1981
|
-
const
|
|
1982
|
-
const
|
|
2044
|
+
const XSRF_ENABLED = new InjectionToken('XSRF_ENABLED');
|
|
2045
|
+
const XSRF_DEFAULT_COOKIE_NAME = 'XSRF-TOKEN';
|
|
2046
|
+
const XSRF_COOKIE_NAME = new InjectionToken('XSRF_COOKIE_NAME', {
|
|
2047
|
+
providedIn: 'root',
|
|
2048
|
+
factory: () => XSRF_DEFAULT_COOKIE_NAME,
|
|
2049
|
+
});
|
|
2050
|
+
const XSRF_DEFAULT_HEADER_NAME = 'X-XSRF-TOKEN';
|
|
2051
|
+
const XSRF_HEADER_NAME = new InjectionToken('XSRF_HEADER_NAME', {
|
|
2052
|
+
providedIn: 'root',
|
|
2053
|
+
factory: () => XSRF_DEFAULT_HEADER_NAME,
|
|
2054
|
+
});
|
|
1983
2055
|
/**
|
|
1984
2056
|
* Retrieves the current XSRF token to use with the next outgoing request.
|
|
1985
2057
|
*
|
|
@@ -2015,9 +2087,9 @@ class HttpXsrfCookieExtractor {
|
|
|
2015
2087
|
return this.lastToken;
|
|
2016
2088
|
}
|
|
2017
2089
|
}
|
|
2018
|
-
HttpXsrfCookieExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2019
|
-
HttpXsrfCookieExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2020
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2090
|
+
HttpXsrfCookieExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2091
|
+
HttpXsrfCookieExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfCookieExtractor });
|
|
2092
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
|
|
2021
2093
|
type: Injectable
|
|
2022
2094
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2023
2095
|
type: Inject,
|
|
@@ -2029,40 +2101,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
2029
2101
|
type: Inject,
|
|
2030
2102
|
args: [XSRF_COOKIE_NAME]
|
|
2031
2103
|
}] }]; } });
|
|
2104
|
+
function xsrfInterceptorFn(req, next) {
|
|
2105
|
+
const lcUrl = req.url.toLowerCase();
|
|
2106
|
+
// Skip both non-mutating requests and absolute URLs.
|
|
2107
|
+
// Non-mutating requests don't require a token, and absolute URLs require special handling
|
|
2108
|
+
// anyway as the cookie set
|
|
2109
|
+
// on our origin is not the same as the token expected by another origin.
|
|
2110
|
+
if (!inject(XSRF_ENABLED) || req.method === 'GET' || req.method === 'HEAD' ||
|
|
2111
|
+
lcUrl.startsWith('http://') || lcUrl.startsWith('https://')) {
|
|
2112
|
+
return next(req);
|
|
2113
|
+
}
|
|
2114
|
+
const token = inject(HttpXsrfTokenExtractor).getToken();
|
|
2115
|
+
const headerName = inject(XSRF_HEADER_NAME);
|
|
2116
|
+
// Be careful not to overwrite an existing header of the same name.
|
|
2117
|
+
if (token != null && !req.headers.has(headerName)) {
|
|
2118
|
+
req = req.clone({ headers: req.headers.set(headerName, token) });
|
|
2119
|
+
}
|
|
2120
|
+
return next(req);
|
|
2121
|
+
}
|
|
2032
2122
|
/**
|
|
2033
2123
|
* `HttpInterceptor` which adds an XSRF token to eligible outgoing requests.
|
|
2034
2124
|
*/
|
|
2035
2125
|
class HttpXsrfInterceptor {
|
|
2036
|
-
constructor(
|
|
2037
|
-
this.
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
const lcUrl = req.url.toLowerCase();
|
|
2042
|
-
// Skip both non-mutating requests and absolute URLs.
|
|
2043
|
-
// Non-mutating requests don't require a token, and absolute URLs require special handling
|
|
2044
|
-
// anyway as the cookie set
|
|
2045
|
-
// on our origin is not the same as the token expected by another origin.
|
|
2046
|
-
if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
|
|
2047
|
-
lcUrl.startsWith('https://')) {
|
|
2048
|
-
return next.handle(req);
|
|
2049
|
-
}
|
|
2050
|
-
const token = this.tokenService.getToken();
|
|
2051
|
-
// Be careful not to overwrite an existing header of the same name.
|
|
2052
|
-
if (token !== null && !req.headers.has(this.headerName)) {
|
|
2053
|
-
req = req.clone({ headers: req.headers.set(this.headerName, token) });
|
|
2054
|
-
}
|
|
2055
|
-
return next.handle(req);
|
|
2126
|
+
constructor(injector) {
|
|
2127
|
+
this.injector = injector;
|
|
2128
|
+
}
|
|
2129
|
+
intercept(initialRequest, next) {
|
|
2130
|
+
return this.injector.runInContext(() => xsrfInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
2056
2131
|
}
|
|
2057
2132
|
}
|
|
2058
|
-
HttpXsrfInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2059
|
-
HttpXsrfInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2060
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2133
|
+
HttpXsrfInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2134
|
+
HttpXsrfInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfInterceptor });
|
|
2135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
|
|
2061
2136
|
type: Injectable
|
|
2062
|
-
}], ctorParameters: function () { return [{ type:
|
|
2063
|
-
type: Inject,
|
|
2064
|
-
args: [XSRF_HEADER_NAME]
|
|
2065
|
-
}] }]; } });
|
|
2137
|
+
}], ctorParameters: function () { return [{ type: i0.EnvironmentInjector }]; } });
|
|
2066
2138
|
|
|
2067
2139
|
/**
|
|
2068
2140
|
* @license
|
|
@@ -2071,62 +2143,128 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
2071
2143
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2072
2144
|
* found in the LICENSE file at https://angular.io/license
|
|
2073
2145
|
*/
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2146
|
+
var HttpFeatureKind;
|
|
2147
|
+
(function (HttpFeatureKind) {
|
|
2148
|
+
HttpFeatureKind[HttpFeatureKind["Interceptors"] = 0] = "Interceptors";
|
|
2149
|
+
HttpFeatureKind[HttpFeatureKind["LegacyInterceptors"] = 1] = "LegacyInterceptors";
|
|
2150
|
+
HttpFeatureKind[HttpFeatureKind["CustomXsrfConfiguration"] = 2] = "CustomXsrfConfiguration";
|
|
2151
|
+
HttpFeatureKind[HttpFeatureKind["NoXsrfProtection"] = 3] = "NoXsrfProtection";
|
|
2152
|
+
HttpFeatureKind[HttpFeatureKind["JsonpSupport"] = 4] = "JsonpSupport";
|
|
2153
|
+
HttpFeatureKind[HttpFeatureKind["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
|
|
2154
|
+
})(HttpFeatureKind || (HttpFeatureKind = {}));
|
|
2155
|
+
function makeHttpFeature(kind, providers) {
|
|
2156
|
+
return {
|
|
2157
|
+
ɵkind: kind,
|
|
2158
|
+
ɵproviders: providers,
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
function provideHttpClient(...features) {
|
|
2162
|
+
if (ngDevMode) {
|
|
2163
|
+
const featureKinds = new Set(features.map(f => f.ɵkind));
|
|
2164
|
+
if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) &&
|
|
2165
|
+
featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
|
|
2166
|
+
throw new Error(ngDevMode ?
|
|
2167
|
+
`Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.` :
|
|
2168
|
+
'');
|
|
2169
|
+
}
|
|
2088
2170
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2171
|
+
const providers = [
|
|
2172
|
+
HttpClient,
|
|
2173
|
+
HttpXhrBackend,
|
|
2174
|
+
HttpInterceptorHandler,
|
|
2175
|
+
{ provide: HttpHandler, useExisting: HttpInterceptorHandler },
|
|
2176
|
+
{ provide: HttpBackend, useExisting: HttpXhrBackend },
|
|
2177
|
+
{
|
|
2178
|
+
provide: HTTP_INTERCEPTOR_FNS,
|
|
2179
|
+
useValue: xsrfInterceptorFn,
|
|
2180
|
+
multi: true,
|
|
2181
|
+
},
|
|
2182
|
+
{ provide: XSRF_ENABLED, useValue: true },
|
|
2183
|
+
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
2184
|
+
];
|
|
2185
|
+
for (const feature of features) {
|
|
2186
|
+
providers.push(...feature.ɵproviders);
|
|
2187
|
+
}
|
|
2188
|
+
return providers;
|
|
2189
|
+
}
|
|
2190
|
+
function withInterceptors(interceptorFns) {
|
|
2191
|
+
return makeHttpFeature(HttpFeatureKind.Interceptors, interceptorFns.map(interceptorFn => {
|
|
2192
|
+
return {
|
|
2193
|
+
provide: HTTP_INTERCEPTOR_FNS,
|
|
2194
|
+
useValue: interceptorFn,
|
|
2195
|
+
multi: true,
|
|
2196
|
+
};
|
|
2197
|
+
}));
|
|
2198
|
+
}
|
|
2199
|
+
const LEGACY_INTERCEPTOR_FN = new InjectionToken('LEGACY_INTERCEPTOR_FN');
|
|
2200
|
+
function withLegacyInterceptors() {
|
|
2201
|
+
// Note: the legacy interceptor function is provided here via an intermediate token
|
|
2202
|
+
// (`LEGACY_INTERCEPTOR_FN`), using a pattern which guarantees that if these providers are
|
|
2203
|
+
// included multiple times, all of the multi-provider entries will have the same instance of the
|
|
2204
|
+
// interceptor function. That way, the `HttpINterceptorHandler` will dedup them and legacy
|
|
2205
|
+
// interceptors will not run multiple times.
|
|
2206
|
+
return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [
|
|
2207
|
+
{
|
|
2208
|
+
provide: LEGACY_INTERCEPTOR_FN,
|
|
2209
|
+
useFactory: legacyInterceptorFnFactory,
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
provide: HTTP_INTERCEPTOR_FNS,
|
|
2213
|
+
useExisting: LEGACY_INTERCEPTOR_FN,
|
|
2214
|
+
multi: true,
|
|
2093
2215
|
}
|
|
2094
|
-
|
|
2216
|
+
]);
|
|
2217
|
+
}
|
|
2218
|
+
function withXsrfConfiguration({ cookieName, headerName }) {
|
|
2219
|
+
const providers = [];
|
|
2220
|
+
if (cookieName !== undefined) {
|
|
2221
|
+
providers.push({ provide: XSRF_COOKIE_NAME, useValue: cookieName });
|
|
2095
2222
|
}
|
|
2223
|
+
if (headerName !== undefined) {
|
|
2224
|
+
providers.push({ provide: XSRF_HEADER_NAME, useValue: headerName });
|
|
2225
|
+
}
|
|
2226
|
+
return makeHttpFeature(HttpFeatureKind.CustomXsrfConfiguration, providers);
|
|
2227
|
+
}
|
|
2228
|
+
function withNoXsrfProtection() {
|
|
2229
|
+
return makeHttpFeature(HttpFeatureKind.NoXsrfProtection, [
|
|
2230
|
+
{
|
|
2231
|
+
provide: XSRF_ENABLED,
|
|
2232
|
+
useValue: false,
|
|
2233
|
+
},
|
|
2234
|
+
]);
|
|
2235
|
+
}
|
|
2236
|
+
function withJsonpSupport() {
|
|
2237
|
+
return makeHttpFeature(HttpFeatureKind.JsonpSupport, [
|
|
2238
|
+
JsonpClientBackend,
|
|
2239
|
+
{ provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
|
|
2240
|
+
{ provide: HTTP_INTERCEPTOR_FNS, useValue: jsonpInterceptorFn, multi: true },
|
|
2241
|
+
]);
|
|
2096
2242
|
}
|
|
2097
|
-
HttpInterceptingHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.5", ngImport: i0, type: HttpInterceptingHandler, deps: [{ token: HttpBackend }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2098
|
-
HttpInterceptingHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0-next.5", ngImport: i0, type: HttpInterceptingHandler });
|
|
2099
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5", ngImport: i0, type: HttpInterceptingHandler, decorators: [{
|
|
2100
|
-
type: Injectable
|
|
2101
|
-
}], ctorParameters: function () { return [{ type: HttpBackend }, { type: i0.Injector }]; } });
|
|
2102
2243
|
/**
|
|
2103
|
-
*
|
|
2104
|
-
* to a request before passing it to the given `HttpBackend`.
|
|
2105
|
-
*
|
|
2106
|
-
* Use as a factory function within `HttpClientModule`.
|
|
2107
|
-
*
|
|
2108
|
-
*
|
|
2244
|
+
* @developerPreview
|
|
2109
2245
|
*/
|
|
2110
|
-
function
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2246
|
+
function withRequestsMadeViaParent() {
|
|
2247
|
+
return makeHttpFeature(HttpFeatureKind.RequestsMadeViaParent, [
|
|
2248
|
+
{
|
|
2249
|
+
provide: HttpBackend,
|
|
2250
|
+
useFactory: () => {
|
|
2251
|
+
const handlerFromParent = inject(HttpHandler, { skipSelf: true, optional: true });
|
|
2252
|
+
if (ngDevMode && handlerFromParent === null) {
|
|
2253
|
+
throw new Error('withRequestsMadeViaParent() can only be used when the parent injector also configures HttpClient');
|
|
2254
|
+
}
|
|
2255
|
+
return handlerFromParent;
|
|
2256
|
+
},
|
|
2257
|
+
},
|
|
2258
|
+
]);
|
|
2115
2259
|
}
|
|
2260
|
+
|
|
2116
2261
|
/**
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2119
|
-
* Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist
|
|
2120
|
-
* in test environments. In that case, callbacks are stored on an anonymous object instead.
|
|
2121
|
-
*
|
|
2262
|
+
* @license
|
|
2263
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2122
2264
|
*
|
|
2265
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2266
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2123
2267
|
*/
|
|
2124
|
-
function jsonpCallbackContext() {
|
|
2125
|
-
if (typeof window === 'object') {
|
|
2126
|
-
return window;
|
|
2127
|
-
}
|
|
2128
|
-
return {};
|
|
2129
|
-
}
|
|
2130
2268
|
/**
|
|
2131
2269
|
* Configures XSRF protection support for outgoing requests.
|
|
2132
2270
|
*
|
|
@@ -2147,7 +2285,7 @@ class HttpClientXsrfModule {
|
|
|
2147
2285
|
return {
|
|
2148
2286
|
ngModule: HttpClientXsrfModule,
|
|
2149
2287
|
providers: [
|
|
2150
|
-
|
|
2288
|
+
withNoXsrfProtection().ɵproviders,
|
|
2151
2289
|
],
|
|
2152
2290
|
};
|
|
2153
2291
|
}
|
|
@@ -2162,31 +2300,34 @@ class HttpClientXsrfModule {
|
|
|
2162
2300
|
static withOptions(options = {}) {
|
|
2163
2301
|
return {
|
|
2164
2302
|
ngModule: HttpClientXsrfModule,
|
|
2165
|
-
providers:
|
|
2166
|
-
options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [],
|
|
2167
|
-
options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : [],
|
|
2168
|
-
],
|
|
2303
|
+
providers: withXsrfConfiguration(options).ɵproviders,
|
|
2169
2304
|
};
|
|
2170
2305
|
}
|
|
2171
2306
|
}
|
|
2172
|
-
HttpClientXsrfModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2173
|
-
HttpClientXsrfModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
2174
|
-
HttpClientXsrfModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2307
|
+
HttpClientXsrfModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2308
|
+
HttpClientXsrfModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientXsrfModule });
|
|
2309
|
+
HttpClientXsrfModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientXsrfModule, providers: [
|
|
2175
2310
|
HttpXsrfInterceptor,
|
|
2176
2311
|
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
|
|
2177
2312
|
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
2178
|
-
{
|
|
2179
|
-
|
|
2313
|
+
withXsrfConfiguration({
|
|
2314
|
+
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2315
|
+
headerName: XSRF_DEFAULT_HEADER_NAME,
|
|
2316
|
+
}).ɵproviders,
|
|
2317
|
+
{ provide: XSRF_ENABLED, useValue: true },
|
|
2180
2318
|
] });
|
|
2181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
|
|
2182
2320
|
type: NgModule,
|
|
2183
2321
|
args: [{
|
|
2184
2322
|
providers: [
|
|
2185
2323
|
HttpXsrfInterceptor,
|
|
2186
2324
|
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
|
|
2187
2325
|
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
2188
|
-
{
|
|
2189
|
-
|
|
2326
|
+
withXsrfConfiguration({
|
|
2327
|
+
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2328
|
+
headerName: XSRF_DEFAULT_HEADER_NAME,
|
|
2329
|
+
}).ɵproviders,
|
|
2330
|
+
{ provide: XSRF_ENABLED, useValue: true },
|
|
2190
2331
|
],
|
|
2191
2332
|
}]
|
|
2192
2333
|
}] });
|
|
@@ -2201,38 +2342,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
2201
2342
|
*/
|
|
2202
2343
|
class HttpClientModule {
|
|
2203
2344
|
}
|
|
2204
|
-
HttpClientModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2205
|
-
HttpClientModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
2206
|
-
HttpClientModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
]
|
|
2212
|
-
|
|
2213
|
-
headerName: 'X-XSRF-TOKEN',
|
|
2214
|
-
})] });
|
|
2215
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5", ngImport: i0, type: HttpClientModule, decorators: [{
|
|
2345
|
+
HttpClientModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2346
|
+
HttpClientModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientModule });
|
|
2347
|
+
HttpClientModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientModule, providers: [
|
|
2348
|
+
provideHttpClient(withLegacyInterceptors(), withXsrfConfiguration({
|
|
2349
|
+
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2350
|
+
headerName: XSRF_DEFAULT_HEADER_NAME,
|
|
2351
|
+
})),
|
|
2352
|
+
] });
|
|
2353
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientModule, decorators: [{
|
|
2216
2354
|
type: NgModule,
|
|
2217
2355
|
args: [{
|
|
2218
|
-
/**
|
|
2219
|
-
* Optional configuration for XSRF protection.
|
|
2220
|
-
*/
|
|
2221
|
-
imports: [
|
|
2222
|
-
HttpClientXsrfModule.withOptions({
|
|
2223
|
-
cookieName: 'XSRF-TOKEN',
|
|
2224
|
-
headerName: 'X-XSRF-TOKEN',
|
|
2225
|
-
}),
|
|
2226
|
-
],
|
|
2227
2356
|
/**
|
|
2228
2357
|
* Configures the [dependency injector](guide/glossary#injector) where it is imported
|
|
2229
2358
|
* with supporting services for HTTP communications.
|
|
2230
2359
|
*/
|
|
2231
2360
|
providers: [
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2361
|
+
provideHttpClient(withLegacyInterceptors(), withXsrfConfiguration({
|
|
2362
|
+
cookieName: XSRF_DEFAULT_COOKIE_NAME,
|
|
2363
|
+
headerName: XSRF_DEFAULT_HEADER_NAME,
|
|
2364
|
+
})),
|
|
2236
2365
|
],
|
|
2237
2366
|
}]
|
|
2238
2367
|
}] });
|
|
@@ -2242,27 +2371,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.5",
|
|
|
2242
2371
|
* Without this module, Jsonp requests reach the backend
|
|
2243
2372
|
* with method JSONP, where they are rejected.
|
|
2244
2373
|
*
|
|
2245
|
-
* You can add interceptors to the chain behind `HttpClient` by binding them to the
|
|
2246
|
-
* multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`.
|
|
2247
|
-
*
|
|
2248
2374
|
* @publicApi
|
|
2249
2375
|
*/
|
|
2250
2376
|
class HttpClientJsonpModule {
|
|
2251
2377
|
}
|
|
2252
|
-
HttpClientJsonpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2253
|
-
HttpClientJsonpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.
|
|
2254
|
-
HttpClientJsonpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2255
|
-
|
|
2256
|
-
{ provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
|
|
2257
|
-
{ provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true },
|
|
2378
|
+
HttpClientJsonpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2379
|
+
HttpClientJsonpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientJsonpModule });
|
|
2380
|
+
HttpClientJsonpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientJsonpModule, providers: [
|
|
2381
|
+
withJsonpSupport().ɵproviders,
|
|
2258
2382
|
] });
|
|
2259
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.
|
|
2383
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0-next.6", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
|
|
2260
2384
|
type: NgModule,
|
|
2261
2385
|
args: [{
|
|
2262
2386
|
providers: [
|
|
2263
|
-
|
|
2264
|
-
{ provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
|
|
2265
|
-
{ provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true },
|
|
2387
|
+
withJsonpSupport().ɵproviders,
|
|
2266
2388
|
],
|
|
2267
2389
|
}]
|
|
2268
2390
|
}] });
|
|
@@ -2296,5 +2418,5 @@ const XhrFactory = XhrFactory$1;
|
|
|
2296
2418
|
* Generated bundle index. Do not edit.
|
|
2297
2419
|
*/
|
|
2298
2420
|
|
|
2299
|
-
export { HTTP_INTERCEPTORS, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, XhrFactory,
|
|
2421
|
+
export { HTTP_INTERCEPTORS, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpFeatureKind, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, XhrFactory, provideHttpClient, withInterceptors, withJsonpSupport, withLegacyInterceptors, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler };
|
|
2300
2422
|
//# sourceMappingURL=http.mjs.map
|