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