@angular/common 16.1.0-next.3 → 16.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.
- package/esm2022/http/public_api.mjs +3 -2
- package/esm2022/http/src/client.mjs +5 -6
- package/esm2022/http/src/fetch.mjs +225 -0
- package/esm2022/http/src/headers.mjs +14 -16
- package/esm2022/http/src/interceptor.mjs +5 -6
- package/esm2022/http/src/jsonp.mjs +9 -11
- package/esm2022/http/src/module.mjs +16 -19
- package/esm2022/http/src/provider.mjs +27 -1
- package/esm2022/http/src/request.mjs +3 -1
- package/esm2022/http/src/response.mjs +3 -1
- package/esm2022/http/src/xhr.mjs +5 -6
- package/esm2022/http/src/xsrf.mjs +9 -11
- package/esm2022/http/testing/src/backend.mjs +5 -6
- package/esm2022/http/testing/src/module.mjs +6 -7
- package/esm2022/src/common_module.mjs +6 -7
- package/esm2022/src/directives/ng_class.mjs +5 -6
- package/esm2022/src/directives/ng_component_outlet.mjs +5 -6
- package/esm2022/src/directives/ng_for_of.mjs +5 -6
- package/esm2022/src/directives/ng_if.mjs +5 -6
- package/esm2022/src/directives/ng_optimized_image/lcp_image_observer.mjs +5 -6
- package/esm2022/src/directives/ng_optimized_image/ng_optimized_image.mjs +42 -85
- package/esm2022/src/directives/ng_optimized_image/preconnect_link_checker.mjs +5 -6
- package/esm2022/src/directives/ng_optimized_image/preload-link-creator.mjs +5 -6
- package/esm2022/src/directives/ng_plural.mjs +9 -11
- package/esm2022/src/directives/ng_style.mjs +5 -6
- package/esm2022/src/directives/ng_switch.mjs +13 -16
- package/esm2022/src/directives/ng_template_outlet.mjs +5 -6
- package/esm2022/src/i18n/localization.mjs +9 -11
- package/esm2022/src/location/hash_location_strategy.mjs +5 -6
- package/esm2022/src/location/location.mjs +5 -6
- package/esm2022/src/location/location_strategy.mjs +9 -11
- package/esm2022/src/location/platform_location.mjs +9 -11
- package/esm2022/src/pipes/async_pipe.mjs +5 -6
- package/esm2022/src/pipes/case_conversion_pipes.mjs +13 -16
- package/esm2022/src/pipes/date_pipe.mjs +5 -6
- package/esm2022/src/pipes/i18n_plural_pipe.mjs +5 -6
- package/esm2022/src/pipes/i18n_select_pipe.mjs +5 -6
- package/esm2022/src/pipes/json_pipe.mjs +5 -6
- package/esm2022/src/pipes/keyvalue_pipe.mjs +5 -6
- package/esm2022/src/pipes/number_pipe.mjs +13 -16
- package/esm2022/src/pipes/slice_pipe.mjs +5 -6
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/viewport_scroller.mjs +2 -3
- package/esm2022/testing/src/location_mock.mjs +5 -6
- package/esm2022/testing/src/mock_location_strategy.mjs +5 -6
- package/esm2022/testing/src/mock_platform_location.mjs +5 -6
- package/esm2022/upgrade/src/location_upgrade_module.mjs +6 -7
- package/fesm2022/common.mjs +151 -193
- package/fesm2022/common.mjs.map +1 -1
- package/fesm2022/http/testing.mjs +8 -8
- package/fesm2022/http/testing.mjs.map +1 -1
- package/fesm2022/http.mjs +291 -51
- package/fesm2022/http.mjs.map +1 -1
- package/fesm2022/testing.mjs +10 -10
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +5 -5
- package/fesm2022/upgrade.mjs.map +1 -1
- package/http/index.d.ts +48 -3
- package/http/testing/index.d.ts +1 -1
- package/index.d.ts +12 -17
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2022/http.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.1.0
|
|
2
|
+
* @license Angular v16.1.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { Injectable,
|
|
8
|
+
import { Injectable, inject, InjectionToken, ɵInitialRenderPendingTasks, Inject, ɵRuntimeError, PLATFORM_ID, makeEnvironmentProviders, NgModule, TransferState, makeStateKey, ɵENABLED_SSR_FEATURES, APP_BOOTSTRAP_LISTENER, ApplicationRef } from '@angular/core';
|
|
9
9
|
import { of, Observable, from } from 'rxjs';
|
|
10
10
|
import { concatMap, filter, map, finalize, switchMap, tap, first } from 'rxjs/operators';
|
|
11
11
|
import * as i1 from '@angular/common';
|
|
@@ -80,6 +80,12 @@ class HttpHeaders {
|
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
+
else if (typeof Headers !== 'undefined' && headers instanceof Headers) {
|
|
84
|
+
this.headers = new Map();
|
|
85
|
+
headers.forEach((values, name) => {
|
|
86
|
+
this.setHeaderEntries(name, values);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
83
89
|
else {
|
|
84
90
|
this.lazyInit = () => {
|
|
85
91
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
@@ -87,21 +93,7 @@ class HttpHeaders {
|
|
|
87
93
|
}
|
|
88
94
|
this.headers = new Map();
|
|
89
95
|
Object.entries(headers).forEach(([name, values]) => {
|
|
90
|
-
|
|
91
|
-
if (typeof values === 'string') {
|
|
92
|
-
headerValues = [values];
|
|
93
|
-
}
|
|
94
|
-
else if (typeof values === 'number') {
|
|
95
|
-
headerValues = [values.toString()];
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
headerValues = values.map((value) => value.toString());
|
|
99
|
-
}
|
|
100
|
-
if (headerValues.length > 0) {
|
|
101
|
-
const key = name.toLowerCase();
|
|
102
|
-
this.headers.set(key, headerValues);
|
|
103
|
-
this.maybeSetNormalizedName(name, key);
|
|
104
|
-
}
|
|
96
|
+
this.setHeaderEntries(name, values);
|
|
105
97
|
});
|
|
106
98
|
};
|
|
107
99
|
}
|
|
@@ -259,6 +251,12 @@ class HttpHeaders {
|
|
|
259
251
|
break;
|
|
260
252
|
}
|
|
261
253
|
}
|
|
254
|
+
setHeaderEntries(name, values) {
|
|
255
|
+
const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());
|
|
256
|
+
const key = name.toLowerCase();
|
|
257
|
+
this.headers.set(key, headerValues);
|
|
258
|
+
this.maybeSetNormalizedName(name, key);
|
|
259
|
+
}
|
|
262
260
|
/**
|
|
263
261
|
* @internal
|
|
264
262
|
*/
|
|
@@ -724,6 +722,8 @@ class HttpRequest {
|
|
|
724
722
|
*
|
|
725
723
|
* Progress events are expensive (change detection runs on each event) and so
|
|
726
724
|
* they should only be requested if the consumer intends to monitor them.
|
|
725
|
+
*
|
|
726
|
+
* Note: The `FetchBackend` doesn't support progress report on uploads.
|
|
727
727
|
*/
|
|
728
728
|
this.reportProgress = false;
|
|
729
729
|
/**
|
|
@@ -934,6 +934,8 @@ var HttpEventType;
|
|
|
934
934
|
HttpEventType[HttpEventType["Sent"] = 0] = "Sent";
|
|
935
935
|
/**
|
|
936
936
|
* An upload progress event was received.
|
|
937
|
+
*
|
|
938
|
+
* Note: The `FetchBackend` doesn't support progress report on uploads.
|
|
937
939
|
*/
|
|
938
940
|
HttpEventType[HttpEventType["UploadProgress"] = 1] = "UploadProgress";
|
|
939
941
|
/**
|
|
@@ -1371,13 +1373,226 @@ class HttpClient {
|
|
|
1371
1373
|
put(url, body, options = {}) {
|
|
1372
1374
|
return this.request('PUT', url, addBody(options, body));
|
|
1373
1375
|
}
|
|
1374
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
1375
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
1376
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1377
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClient }); }
|
|
1376
1378
|
}
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
1379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClient, decorators: [{
|
|
1378
1380
|
type: Injectable
|
|
1379
1381
|
}], ctorParameters: function () { return [{ type: HttpHandler }]; } });
|
|
1380
1382
|
|
|
1383
|
+
const XSSI_PREFIX$1 = /^\)\]\}',?\n/;
|
|
1384
|
+
const REQUEST_URL_HEADER = `X-Request-URL`;
|
|
1385
|
+
/**
|
|
1386
|
+
* Determine an appropriate URL for the response, by checking either
|
|
1387
|
+
* response url or the X-Request-URL header.
|
|
1388
|
+
*/
|
|
1389
|
+
function getResponseUrl$1(response) {
|
|
1390
|
+
if (response.url) {
|
|
1391
|
+
return response.url;
|
|
1392
|
+
}
|
|
1393
|
+
// stored as lowercase in the map
|
|
1394
|
+
const xRequestUrl = REQUEST_URL_HEADER.toLocaleLowerCase();
|
|
1395
|
+
return response.headers.get(xRequestUrl);
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Uses `fetch` to send requests to a backend server.
|
|
1399
|
+
*
|
|
1400
|
+
* This `FetchBackend` requires the support of the
|
|
1401
|
+
* [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) which is available on all
|
|
1402
|
+
* supported browsers and on Node.js v18 or later.
|
|
1403
|
+
*
|
|
1404
|
+
* @see {@link HttpHandler}
|
|
1405
|
+
*
|
|
1406
|
+
* @publicApi
|
|
1407
|
+
* @developerPreview
|
|
1408
|
+
*/
|
|
1409
|
+
class FetchBackend {
|
|
1410
|
+
constructor() {
|
|
1411
|
+
// We need to bind the native fetch to its context or it will throw an "illegal invocation"
|
|
1412
|
+
this.fetchImpl = inject(FetchFactory, { optional: true })?.fetch ?? fetch.bind(globalThis);
|
|
1413
|
+
}
|
|
1414
|
+
handle(request) {
|
|
1415
|
+
return new Observable(observer => {
|
|
1416
|
+
const aborter = new AbortController();
|
|
1417
|
+
this.doRequest(request, aborter.signal, observer)
|
|
1418
|
+
.then(noop, error => observer.error(new HttpErrorResponse({ error })));
|
|
1419
|
+
return () => aborter.abort();
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
async doRequest(request, signal, observer) {
|
|
1423
|
+
const init = this.createRequestInit(request);
|
|
1424
|
+
let response;
|
|
1425
|
+
try {
|
|
1426
|
+
const fetchPromise = this.fetchImpl(request.url, { signal, ...init });
|
|
1427
|
+
// Make sure Zone.js doesn't trigger false-positive unhandled promise
|
|
1428
|
+
// error in case the Promise is rejected synchronously. See function
|
|
1429
|
+
// description for additional information.
|
|
1430
|
+
silenceSuperfluousUnhandledPromiseRejection(fetchPromise);
|
|
1431
|
+
// Send the `Sent` event before awaiting the response.
|
|
1432
|
+
observer.next({ type: HttpEventType.Sent });
|
|
1433
|
+
response = await fetchPromise;
|
|
1434
|
+
}
|
|
1435
|
+
catch (error) {
|
|
1436
|
+
observer.error(new HttpErrorResponse({
|
|
1437
|
+
error,
|
|
1438
|
+
status: error.status ?? 0,
|
|
1439
|
+
statusText: error.statusText,
|
|
1440
|
+
url: request.url,
|
|
1441
|
+
headers: error.headers,
|
|
1442
|
+
}));
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
const headers = new HttpHeaders(response.headers);
|
|
1446
|
+
const statusText = response.statusText;
|
|
1447
|
+
const url = getResponseUrl$1(response) ?? request.url;
|
|
1448
|
+
let status = response.status;
|
|
1449
|
+
let body = null;
|
|
1450
|
+
if (request.reportProgress) {
|
|
1451
|
+
observer.next(new HttpHeaderResponse({ headers, status, statusText, url }));
|
|
1452
|
+
}
|
|
1453
|
+
if (response.body) {
|
|
1454
|
+
// Read Progress
|
|
1455
|
+
const contentLength = response.headers.get('content-length');
|
|
1456
|
+
const chunks = [];
|
|
1457
|
+
const reader = response.body.getReader();
|
|
1458
|
+
let receivedLength = 0;
|
|
1459
|
+
let decoder;
|
|
1460
|
+
let partialText;
|
|
1461
|
+
while (true) {
|
|
1462
|
+
const { done, value } = await reader.read();
|
|
1463
|
+
if (done) {
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
chunks.push(value);
|
|
1467
|
+
receivedLength += value.length;
|
|
1468
|
+
if (request.reportProgress) {
|
|
1469
|
+
partialText = request.responseType === 'text' ?
|
|
1470
|
+
(partialText ?? '') + (decoder ??= new TextDecoder).decode(value, { stream: true }) :
|
|
1471
|
+
undefined;
|
|
1472
|
+
observer.next({
|
|
1473
|
+
type: HttpEventType.DownloadProgress,
|
|
1474
|
+
total: contentLength ? +contentLength : undefined,
|
|
1475
|
+
loaded: receivedLength,
|
|
1476
|
+
partialText,
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
// Combine all chunks.
|
|
1481
|
+
const chunksAll = this.concatChunks(chunks, receivedLength);
|
|
1482
|
+
try {
|
|
1483
|
+
body = this.parseBody(request, chunksAll);
|
|
1484
|
+
}
|
|
1485
|
+
catch (error) {
|
|
1486
|
+
// Body loading or parsing failed
|
|
1487
|
+
observer.error(new HttpErrorResponse({
|
|
1488
|
+
error,
|
|
1489
|
+
headers: new HttpHeaders(response.headers),
|
|
1490
|
+
status: response.status,
|
|
1491
|
+
statusText: response.statusText,
|
|
1492
|
+
url: getResponseUrl$1(response) ?? request.url,
|
|
1493
|
+
}));
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
// Same behavior as the XhrBackend
|
|
1498
|
+
if (status === 0) {
|
|
1499
|
+
status = body ? 200 /* HttpStatusCode.Ok */ : 0;
|
|
1500
|
+
}
|
|
1501
|
+
// ok determines whether the response will be transmitted on the event or
|
|
1502
|
+
// error channel. Unsuccessful status codes (not 2xx) will always be errors,
|
|
1503
|
+
// but a successful status code can still result in an error if the user
|
|
1504
|
+
// asked for JSON data and the body cannot be parsed as such.
|
|
1505
|
+
const ok = status >= 200 && status < 300;
|
|
1506
|
+
if (ok) {
|
|
1507
|
+
observer.next(new HttpResponse({
|
|
1508
|
+
body,
|
|
1509
|
+
headers,
|
|
1510
|
+
status,
|
|
1511
|
+
statusText,
|
|
1512
|
+
url,
|
|
1513
|
+
}));
|
|
1514
|
+
// The full body has been received and delivered, no further events
|
|
1515
|
+
// are possible. This request is complete.
|
|
1516
|
+
observer.complete();
|
|
1517
|
+
}
|
|
1518
|
+
else {
|
|
1519
|
+
observer.error(new HttpErrorResponse({
|
|
1520
|
+
error: body,
|
|
1521
|
+
headers,
|
|
1522
|
+
status,
|
|
1523
|
+
statusText,
|
|
1524
|
+
url,
|
|
1525
|
+
}));
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
parseBody(request, binContent) {
|
|
1529
|
+
switch (request.responseType) {
|
|
1530
|
+
case 'json':
|
|
1531
|
+
// stripping the XSSI when present
|
|
1532
|
+
const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, '');
|
|
1533
|
+
return text === '' ? null : JSON.parse(text);
|
|
1534
|
+
case 'text':
|
|
1535
|
+
return new TextDecoder().decode(binContent);
|
|
1536
|
+
case 'blob':
|
|
1537
|
+
return new Blob([binContent]);
|
|
1538
|
+
case 'arraybuffer':
|
|
1539
|
+
return binContent.buffer;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
createRequestInit(req) {
|
|
1543
|
+
// We could share some of this logic with the XhrBackend
|
|
1544
|
+
const headers = {};
|
|
1545
|
+
const credentials = req.withCredentials ? 'include' : undefined;
|
|
1546
|
+
// Setting all the requested headers.
|
|
1547
|
+
req.headers.forEach((name, values) => (headers[name] = values.join(',')));
|
|
1548
|
+
// Add an Accept header if one isn't present already.
|
|
1549
|
+
headers['Accept'] ??= 'application/json, text/plain, */*';
|
|
1550
|
+
// Auto-detect the Content-Type header if one isn't present already.
|
|
1551
|
+
if (!headers['Content-Type']) {
|
|
1552
|
+
const detectedType = req.detectContentTypeHeader();
|
|
1553
|
+
// Sometimes Content-Type detection fails.
|
|
1554
|
+
if (detectedType !== null) {
|
|
1555
|
+
headers['Content-Type'] = detectedType;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
return {
|
|
1559
|
+
body: req.body,
|
|
1560
|
+
method: req.method,
|
|
1561
|
+
headers,
|
|
1562
|
+
credentials,
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
concatChunks(chunks, totalLength) {
|
|
1566
|
+
const chunksAll = new Uint8Array(totalLength);
|
|
1567
|
+
let position = 0;
|
|
1568
|
+
for (const chunk of chunks) {
|
|
1569
|
+
chunksAll.set(chunk, position);
|
|
1570
|
+
position += chunk.length;
|
|
1571
|
+
}
|
|
1572
|
+
return chunksAll;
|
|
1573
|
+
}
|
|
1574
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1575
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: FetchBackend }); }
|
|
1576
|
+
}
|
|
1577
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: FetchBackend, decorators: [{
|
|
1578
|
+
type: Injectable
|
|
1579
|
+
}] });
|
|
1580
|
+
/**
|
|
1581
|
+
* Abstract class to provide a mocked implementation of `fetch()`
|
|
1582
|
+
*/
|
|
1583
|
+
class FetchFactory {
|
|
1584
|
+
}
|
|
1585
|
+
function noop() { }
|
|
1586
|
+
/**
|
|
1587
|
+
* Zone.js treats a rejected promise that has not yet been awaited
|
|
1588
|
+
* as an unhandled error. This function adds a noop `.then` to make
|
|
1589
|
+
* sure that Zone.js doesn't throw an error if the Promise is rejected
|
|
1590
|
+
* synchronously.
|
|
1591
|
+
*/
|
|
1592
|
+
function silenceSuperfluousUnhandledPromiseRejection(promise) {
|
|
1593
|
+
promise.then(noop, noop);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1381
1596
|
function interceptorChainEndFn(req, finalHandlerFn) {
|
|
1382
1597
|
return finalHandlerFn(req);
|
|
1383
1598
|
}
|
|
@@ -1458,10 +1673,10 @@ class HttpInterceptorHandler extends HttpHandler {
|
|
|
1458
1673
|
return this.chain(initialRequest, downstreamRequest => this.backend.handle(downstreamRequest))
|
|
1459
1674
|
.pipe(finalize(() => this.pendingTasks.remove(taskId)));
|
|
1460
1675
|
}
|
|
1461
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
1462
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
1676
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1677
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpInterceptorHandler }); }
|
|
1463
1678
|
}
|
|
1464
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
1679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
|
|
1465
1680
|
type: Injectable
|
|
1466
1681
|
}], ctorParameters: function () { return [{ type: HttpBackend }, { type: i0.EnvironmentInjector }]; } });
|
|
1467
1682
|
|
|
@@ -1663,10 +1878,10 @@ class JsonpClientBackend {
|
|
|
1663
1878
|
}
|
|
1664
1879
|
foreignDocument.adoptNode(script);
|
|
1665
1880
|
}
|
|
1666
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
1667
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
1881
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1882
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpClientBackend }); }
|
|
1668
1883
|
}
|
|
1669
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
1884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpClientBackend, decorators: [{
|
|
1670
1885
|
type: Injectable
|
|
1671
1886
|
}], ctorParameters: function () { return [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
|
|
1672
1887
|
type: Inject,
|
|
@@ -1704,10 +1919,10 @@ class JsonpInterceptor {
|
|
|
1704
1919
|
intercept(initialRequest, next) {
|
|
1705
1920
|
return this.injector.runInContext(() => jsonpInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
1706
1921
|
}
|
|
1707
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
1708
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
1922
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1923
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpInterceptor }); }
|
|
1709
1924
|
}
|
|
1710
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
1925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: JsonpInterceptor, decorators: [{
|
|
1711
1926
|
type: Injectable
|
|
1712
1927
|
}], ctorParameters: function () { return [{ type: i0.EnvironmentInjector }]; } });
|
|
1713
1928
|
|
|
@@ -1986,10 +2201,10 @@ class HttpXhrBackend {
|
|
|
1986
2201
|
});
|
|
1987
2202
|
}));
|
|
1988
2203
|
}
|
|
1989
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
1990
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
2204
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXhrBackend, deps: [{ token: i1.XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2205
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXhrBackend }); }
|
|
1991
2206
|
}
|
|
1992
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXhrBackend, decorators: [{
|
|
1993
2208
|
type: Injectable
|
|
1994
2209
|
}], ctorParameters: function () { return [{ type: i1.XhrFactory }]; } });
|
|
1995
2210
|
|
|
@@ -2038,10 +2253,10 @@ class HttpXsrfCookieExtractor {
|
|
|
2038
2253
|
}
|
|
2039
2254
|
return this.lastToken;
|
|
2040
2255
|
}
|
|
2041
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
2042
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
2256
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2257
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfCookieExtractor }); }
|
|
2043
2258
|
}
|
|
2044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
|
|
2045
2260
|
type: Injectable
|
|
2046
2261
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2047
2262
|
type: Inject,
|
|
@@ -2081,10 +2296,10 @@ class HttpXsrfInterceptor {
|
|
|
2081
2296
|
intercept(initialRequest, next) {
|
|
2082
2297
|
return this.injector.runInContext(() => xsrfInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
2083
2298
|
}
|
|
2084
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
2085
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0
|
|
2299
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2300
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfInterceptor }); }
|
|
2086
2301
|
}
|
|
2087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
|
|
2088
2303
|
type: Injectable
|
|
2089
2304
|
}], ctorParameters: function () { return [{ type: i0.EnvironmentInjector }]; } });
|
|
2090
2305
|
|
|
@@ -2101,6 +2316,7 @@ var HttpFeatureKind;
|
|
|
2101
2316
|
HttpFeatureKind[HttpFeatureKind["NoXsrfProtection"] = 3] = "NoXsrfProtection";
|
|
2102
2317
|
HttpFeatureKind[HttpFeatureKind["JsonpSupport"] = 4] = "JsonpSupport";
|
|
2103
2318
|
HttpFeatureKind[HttpFeatureKind["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
|
|
2319
|
+
HttpFeatureKind[HttpFeatureKind["Fetch"] = 6] = "Fetch";
|
|
2104
2320
|
})(HttpFeatureKind || (HttpFeatureKind = {}));
|
|
2105
2321
|
function makeHttpFeature(kind, providers) {
|
|
2106
2322
|
return {
|
|
@@ -2122,6 +2338,7 @@ function makeHttpFeature(kind, providers) {
|
|
|
2122
2338
|
* @see {@link withNoXsrfProtection}
|
|
2123
2339
|
* @see {@link withJsonpSupport}
|
|
2124
2340
|
* @see {@link withRequestsMadeViaParent}
|
|
2341
|
+
* @see {@link withFetch}
|
|
2125
2342
|
*/
|
|
2126
2343
|
function provideHttpClient(...features) {
|
|
2127
2344
|
if (ngDevMode) {
|
|
@@ -2277,6 +2494,29 @@ function withRequestsMadeViaParent() {
|
|
|
2277
2494
|
},
|
|
2278
2495
|
]);
|
|
2279
2496
|
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Configures the current `HttpClient` instance to make requests using the fetch API.
|
|
2499
|
+
*
|
|
2500
|
+
* This `FetchBackend` requires the support of the Fetch API which is available on all evergreen
|
|
2501
|
+
* browsers and on NodeJS from v18 onward.
|
|
2502
|
+
*
|
|
2503
|
+
* Note: The Fetch API doesn't support progress report on uploads.
|
|
2504
|
+
*
|
|
2505
|
+
* @publicApi
|
|
2506
|
+
* @developerPreview
|
|
2507
|
+
*/
|
|
2508
|
+
function withFetch() {
|
|
2509
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && typeof fetch !== 'function') {
|
|
2510
|
+
// TODO: Create a runtime error
|
|
2511
|
+
// TODO: Use ENVIRONMENT_INITIALIZER to contextualize the error message (browser or server)
|
|
2512
|
+
throw new Error('The `withFetch` feature of HttpClient requires the `fetch` API to be available. ' +
|
|
2513
|
+
'If you run the code in a Node environment, make sure you use Node v18.10 or later.');
|
|
2514
|
+
}
|
|
2515
|
+
return makeHttpFeature(HttpFeatureKind.Fetch, [
|
|
2516
|
+
FetchBackend,
|
|
2517
|
+
{ provide: HttpBackend, useExisting: FetchBackend },
|
|
2518
|
+
]);
|
|
2519
|
+
}
|
|
2280
2520
|
|
|
2281
2521
|
/**
|
|
2282
2522
|
* Configures XSRF protection support for outgoing requests.
|
|
@@ -2316,9 +2556,9 @@ class HttpClientXsrfModule {
|
|
|
2316
2556
|
providers: withXsrfConfiguration(options).ɵproviders,
|
|
2317
2557
|
};
|
|
2318
2558
|
}
|
|
2319
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
2320
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0
|
|
2321
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0
|
|
2559
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2560
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0", ngImport: i0, type: HttpClientXsrfModule }); }
|
|
2561
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientXsrfModule, providers: [
|
|
2322
2562
|
HttpXsrfInterceptor,
|
|
2323
2563
|
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
|
|
2324
2564
|
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
@@ -2329,7 +2569,7 @@ class HttpClientXsrfModule {
|
|
|
2329
2569
|
{ provide: XSRF_ENABLED, useValue: true },
|
|
2330
2570
|
] }); }
|
|
2331
2571
|
}
|
|
2332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
|
|
2333
2573
|
type: NgModule,
|
|
2334
2574
|
args: [{
|
|
2335
2575
|
providers: [
|
|
@@ -2354,13 +2594,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0-next.3",
|
|
|
2354
2594
|
* @publicApi
|
|
2355
2595
|
*/
|
|
2356
2596
|
class HttpClientModule {
|
|
2357
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
2358
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0
|
|
2359
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0
|
|
2597
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2598
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0", ngImport: i0, type: HttpClientModule }); }
|
|
2599
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientModule, providers: [
|
|
2360
2600
|
provideHttpClient(withInterceptorsFromDi()),
|
|
2361
2601
|
] }); }
|
|
2362
2602
|
}
|
|
2363
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2603
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientModule, decorators: [{
|
|
2364
2604
|
type: NgModule,
|
|
2365
2605
|
args: [{
|
|
2366
2606
|
/**
|
|
@@ -2381,13 +2621,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0-next.3",
|
|
|
2381
2621
|
* @publicApi
|
|
2382
2622
|
*/
|
|
2383
2623
|
class HttpClientJsonpModule {
|
|
2384
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0
|
|
2385
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0
|
|
2386
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0
|
|
2624
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2625
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.0", ngImport: i0, type: HttpClientJsonpModule }); }
|
|
2626
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientJsonpModule, providers: [
|
|
2387
2627
|
withJsonpSupport().ɵproviders,
|
|
2388
2628
|
] }); }
|
|
2389
2629
|
}
|
|
2390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0
|
|
2630
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.0", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
|
|
2391
2631
|
type: NgModule,
|
|
2392
2632
|
args: [{
|
|
2393
2633
|
providers: [
|
|
@@ -2528,5 +2768,5 @@ function withHttpTransferCache() {
|
|
|
2528
2768
|
* Generated bundle index. Do not edit.
|
|
2529
2769
|
*/
|
|
2530
2770
|
|
|
2531
|
-
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, provideHttpClient, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, withHttpTransferCache as ɵwithHttpTransferCache };
|
|
2771
|
+
export { FetchBackend, HTTP_INTERCEPTORS, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpFeatureKind, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, withHttpTransferCache as ɵwithHttpTransferCache };
|
|
2532
2772
|
//# sourceMappingURL=http.mjs.map
|