@angular/common 17.1.0 → 17.1.2
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 +6 -6
- package/esm2022/http/src/client.mjs +6 -6
- package/esm2022/http/src/fetch.mjs +12 -11
- package/esm2022/http/src/headers.mjs +7 -9
- package/esm2022/http/src/interceptor.mjs +11 -10
- package/esm2022/http/src/jsonp.mjs +11 -13
- package/esm2022/http/src/module.mjs +18 -28
- package/esm2022/http/src/params.mjs +15 -14
- package/esm2022/http/src/private_export.mjs +2 -2
- package/esm2022/http/src/provider.mjs +13 -13
- package/esm2022/http/src/request.mjs +19 -21
- package/esm2022/http/src/response.mjs +3 -3
- package/esm2022/http/src/transfer_cache.mjs +15 -11
- package/esm2022/http/src/xhr.mjs +11 -10
- package/esm2022/http/src/xsrf.mjs +17 -14
- package/esm2022/http/testing/src/api.mjs +1 -1
- package/esm2022/http/testing/src/backend.mjs +11 -11
- package/esm2022/http/testing/src/module.mjs +7 -13
- package/esm2022/http/testing/src/provider.mjs +1 -1
- package/esm2022/http/testing/src/request.mjs +11 -8
- package/esm2022/src/common.mjs +6 -6
- package/esm2022/src/common_module.mjs +5 -5
- package/esm2022/src/cookie.mjs +1 -1
- package/esm2022/src/directives/index.mjs +1 -1
- package/esm2022/src/directives/ng_class.mjs +6 -6
- package/esm2022/src/directives/ng_component_outlet.mjs +11 -13
- package/esm2022/src/directives/ng_for_of.mjs +5 -5
- package/esm2022/src/directives/ng_if.mjs +7 -9
- package/esm2022/src/directives/ng_optimized_image/asserts.mjs +1 -1
- package/esm2022/src/directives/ng_optimized_image/error_helper.mjs +4 -2
- package/esm2022/src/directives/ng_optimized_image/image_loaders/cloudflare_loader.mjs +1 -1
- package/esm2022/src/directives/ng_optimized_image/image_loaders/cloudinary_loader.mjs +9 -8
- package/esm2022/src/directives/ng_optimized_image/image_loaders/image_loader.mjs +2 -2
- package/esm2022/src/directives/ng_optimized_image/image_loaders/imagekit_loader.mjs +1 -1
- package/esm2022/src/directives/ng_optimized_image/image_loaders/imgix_loader.mjs +2 -2
- package/esm2022/src/directives/ng_optimized_image/lcp_image_observer.mjs +6 -6
- package/esm2022/src/directives/ng_optimized_image/ng_optimized_image.mjs +35 -28
- package/esm2022/src/directives/ng_optimized_image/preconnect_link_checker.mjs +12 -14
- package/esm2022/src/directives/ng_optimized_image/preload-link-creator.mjs +4 -4
- package/esm2022/src/directives/ng_optimized_image/tokens.mjs +5 -2
- package/esm2022/src/directives/ng_optimized_image/url.mjs +2 -2
- package/esm2022/src/directives/ng_plural.mjs +7 -7
- package/esm2022/src/directives/ng_style.mjs +5 -5
- package/esm2022/src/directives/ng_switch.mjs +17 -15
- package/esm2022/src/directives/ng_switch_equality.mjs +1 -1
- package/esm2022/src/directives/ng_template_outlet.mjs +5 -5
- package/esm2022/src/dom_adapter.mjs +2 -4
- package/esm2022/src/dom_tokens.mjs +2 -2
- package/esm2022/src/i18n/format_date.mjs +62 -43
- package/esm2022/src/i18n/format_number.mjs +14 -13
- package/esm2022/src/i18n/locale_data.mjs +1 -1
- package/esm2022/src/i18n/locale_data_api.mjs +14 -8
- package/esm2022/src/i18n/localization.mjs +7 -7
- package/esm2022/src/location/hash_location_strategy.mjs +6 -8
- package/esm2022/src/location/index.mjs +2 -2
- package/esm2022/src/location/location.mjs +9 -11
- package/esm2022/src/location/location_strategy.mjs +14 -11
- package/esm2022/src/location/platform_location.mjs +9 -9
- package/esm2022/src/location/util.mjs +2 -2
- package/esm2022/src/navigation/platform_navigation.mjs +4 -4
- package/esm2022/src/pipes/async_pipe.mjs +7 -7
- package/esm2022/src/pipes/case_conversion_pipes.mjs +11 -11
- package/esm2022/src/pipes/date_pipe.mjs +70 -71
- package/esm2022/src/pipes/i18n_plural_pipe.mjs +4 -5
- package/esm2022/src/pipes/i18n_select_pipe.mjs +4 -5
- package/esm2022/src/pipes/index.mjs +1 -1
- package/esm2022/src/pipes/invalid_pipe_argument_error.mjs +1 -1
- package/esm2022/src/pipes/json_pipe.mjs +3 -3
- package/esm2022/src/pipes/keyvalue_pipe.mjs +7 -9
- package/esm2022/src/pipes/number_pipe.mjs +13 -13
- package/esm2022/src/pipes/slice_pipe.mjs +4 -4
- package/esm2022/src/private_export.mjs +2 -2
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/viewport_scroller.mjs +6 -5
- package/esm2022/testing/src/location_mock.mjs +34 -19
- package/esm2022/testing/src/mock_location_strategy.mjs +6 -6
- package/esm2022/testing/src/mock_platform_location.mjs +33 -12
- package/esm2022/testing/src/navigation/fake_navigation.mjs +11 -9
- package/esm2022/testing/src/navigation/provide_fake_platform_navigation.mjs +2 -2
- package/esm2022/testing/src/testing.mjs +2 -2
- package/esm2022/upgrade/src/index.mjs +2 -2
- package/esm2022/upgrade/src/location_shim.mjs +11 -13
- package/esm2022/upgrade/src/location_upgrade_module.mjs +15 -18
- package/esm2022/upgrade/src/params.mjs +6 -6
- package/esm2022/upgrade/src/utils.mjs +2 -2
- package/fesm2022/common.mjs +366 -338
- package/fesm2022/common.mjs.map +1 -1
- package/fesm2022/http/testing.mjs +26 -29
- package/fesm2022/http/testing.mjs.map +1 -1
- package/fesm2022/http.mjs +133 -138
- package/fesm2022/http.mjs.map +1 -1
- package/fesm2022/testing.mjs +70 -34
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +30 -35
- package/fesm2022/upgrade.mjs.map +1 -1
- package/http/index.d.ts +2 -2
- package/http/testing/index.d.ts +3 -3
- package/index.d.ts +69 -69
- package/locales/ff-CM.mjs +31 -11
- package/locales/ff-GN.mjs +31 -11
- package/locales/ff-MR.mjs +31 -11
- package/locales/global/ff-CM.js +58 -44
- package/locales/global/ff-GN.js +58 -44
- package/locales/global/ff-MR.js +58 -44
- 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,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.1.
|
|
2
|
+
* @license Angular v17.1.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -63,7 +63,7 @@ class HttpHeaders {
|
|
|
63
63
|
else if (typeof headers === 'string') {
|
|
64
64
|
this.lazyInit = () => {
|
|
65
65
|
this.headers = new Map();
|
|
66
|
-
headers.split('\n').forEach(line => {
|
|
66
|
+
headers.split('\n').forEach((line) => {
|
|
67
67
|
const index = line.indexOf(':');
|
|
68
68
|
if (index > 0) {
|
|
69
69
|
const name = line.slice(0, index);
|
|
@@ -192,22 +192,21 @@ class HttpHeaders {
|
|
|
192
192
|
}
|
|
193
193
|
this.lazyInit = null;
|
|
194
194
|
if (!!this.lazyUpdate) {
|
|
195
|
-
this.lazyUpdate.forEach(update => this.applyUpdate(update));
|
|
195
|
+
this.lazyUpdate.forEach((update) => this.applyUpdate(update));
|
|
196
196
|
this.lazyUpdate = null;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
copyFrom(other) {
|
|
201
201
|
other.init();
|
|
202
|
-
Array.from(other.headers.keys()).forEach(key => {
|
|
202
|
+
Array.from(other.headers.keys()).forEach((key) => {
|
|
203
203
|
this.headers.set(key, other.headers.get(key));
|
|
204
204
|
this.normalizedNames.set(key, other.normalizedNames.get(key));
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
clone(update) {
|
|
208
208
|
const clone = new HttpHeaders();
|
|
209
|
-
clone.lazyInit =
|
|
210
|
-
(!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this;
|
|
209
|
+
clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof HttpHeaders ? this.lazyInit : this;
|
|
211
210
|
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
|
|
212
211
|
return clone;
|
|
213
212
|
}
|
|
@@ -239,7 +238,7 @@ class HttpHeaders {
|
|
|
239
238
|
if (!existing) {
|
|
240
239
|
return;
|
|
241
240
|
}
|
|
242
|
-
existing = existing.filter(value => toDelete.indexOf(value) === -1);
|
|
241
|
+
existing = existing.filter((value) => toDelete.indexOf(value) === -1);
|
|
243
242
|
if (existing.length === 0) {
|
|
244
243
|
this.headers.delete(key);
|
|
245
244
|
this.normalizedNames.delete(key);
|
|
@@ -262,8 +261,7 @@ class HttpHeaders {
|
|
|
262
261
|
*/
|
|
263
262
|
forEach(fn) {
|
|
264
263
|
this.init();
|
|
265
|
-
Array.from(this.normalizedNames.keys())
|
|
266
|
-
.forEach(key => fn(this.normalizedNames.get(key), this.headers.get(key)));
|
|
264
|
+
Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
267
|
/**
|
|
@@ -333,9 +331,9 @@ function paramParser(rawParams, codec) {
|
|
|
333
331
|
const params = rawParams.replace(/^\?/, '').split('&');
|
|
334
332
|
params.forEach((param) => {
|
|
335
333
|
const eqIdx = param.indexOf('=');
|
|
336
|
-
const [key, val] = eqIdx == -1
|
|
337
|
-
[codec.decodeKey(param), '']
|
|
338
|
-
[codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
|
|
334
|
+
const [key, val] = eqIdx == -1
|
|
335
|
+
? [codec.decodeKey(param), '']
|
|
336
|
+
: [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
|
|
339
337
|
const list = map.get(key) || [];
|
|
340
338
|
list.push(val);
|
|
341
339
|
map.set(key, list);
|
|
@@ -384,7 +382,7 @@ class HttpParams {
|
|
|
384
382
|
}
|
|
385
383
|
else if (!!options.fromObject) {
|
|
386
384
|
this.map = new Map();
|
|
387
|
-
Object.keys(options.fromObject).forEach(key => {
|
|
385
|
+
Object.keys(options.fromObject).forEach((key) => {
|
|
388
386
|
const value = options.fromObject[key];
|
|
389
387
|
// convert the values to strings
|
|
390
388
|
const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];
|
|
@@ -450,10 +448,10 @@ class HttpParams {
|
|
|
450
448
|
*/
|
|
451
449
|
appendAll(params) {
|
|
452
450
|
const updates = [];
|
|
453
|
-
Object.keys(params).forEach(param => {
|
|
451
|
+
Object.keys(params).forEach((param) => {
|
|
454
452
|
const value = params[param];
|
|
455
453
|
if (Array.isArray(value)) {
|
|
456
|
-
value.forEach(_value => {
|
|
454
|
+
value.forEach((_value) => {
|
|
457
455
|
updates.push({ param, value: _value, op: 'a' });
|
|
458
456
|
});
|
|
459
457
|
}
|
|
@@ -488,19 +486,20 @@ class HttpParams {
|
|
|
488
486
|
*/
|
|
489
487
|
toString() {
|
|
490
488
|
this.init();
|
|
491
|
-
return this.keys()
|
|
492
|
-
.map(key => {
|
|
489
|
+
return (this.keys()
|
|
490
|
+
.map((key) => {
|
|
493
491
|
const eKey = this.encoder.encodeKey(key);
|
|
494
492
|
// `a: ['1']` produces `'a=1'`
|
|
495
493
|
// `b: []` produces `''`
|
|
496
494
|
// `c: ['1', '2']` produces `'c=1&c=2'`
|
|
497
|
-
return this.map.get(key)
|
|
495
|
+
return this.map.get(key)
|
|
496
|
+
.map((value) => eKey + '=' + this.encoder.encodeValue(value))
|
|
498
497
|
.join('&');
|
|
499
498
|
})
|
|
500
499
|
// filter out empty values because `b: []` produces `''`
|
|
501
500
|
// which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't
|
|
502
|
-
.filter(param => param !== '')
|
|
503
|
-
.join('&');
|
|
501
|
+
.filter((param) => param !== '')
|
|
502
|
+
.join('&'));
|
|
504
503
|
}
|
|
505
504
|
clone(update) {
|
|
506
505
|
const clone = new HttpParams({ encoder: this.encoder });
|
|
@@ -514,8 +513,8 @@ class HttpParams {
|
|
|
514
513
|
}
|
|
515
514
|
if (this.cloneFrom !== null) {
|
|
516
515
|
this.cloneFrom.init();
|
|
517
|
-
this.cloneFrom.keys().forEach(key => this.map.set(key, this.cloneFrom.map.get(key)));
|
|
518
|
-
this.updates.forEach(update => {
|
|
516
|
+
this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
|
|
517
|
+
this.updates.forEach((update) => {
|
|
519
518
|
switch (update.op) {
|
|
520
519
|
case 'a':
|
|
521
520
|
case 's':
|
|
@@ -745,7 +744,7 @@ class HttpRequest {
|
|
|
745
744
|
// the body argument is to use a known no-body method like GET.
|
|
746
745
|
if (mightHaveBody(this.method) || !!fourth) {
|
|
747
746
|
// Body is the third argument, options are the fourth.
|
|
748
|
-
this.body =
|
|
747
|
+
this.body = third !== undefined ? third : null;
|
|
749
748
|
options = fourth;
|
|
750
749
|
}
|
|
751
750
|
else {
|
|
@@ -775,13 +774,9 @@ class HttpRequest {
|
|
|
775
774
|
this.transferCache = options.transferCache;
|
|
776
775
|
}
|
|
777
776
|
// If no headers have been passed in, construct a new HttpHeaders instance.
|
|
778
|
-
|
|
779
|
-
this.headers = new HttpHeaders();
|
|
780
|
-
}
|
|
777
|
+
this.headers ??= new HttpHeaders();
|
|
781
778
|
// If no context have been passed in, construct a new HttpContext instance.
|
|
782
|
-
|
|
783
|
-
this.context = new HttpContext();
|
|
784
|
-
}
|
|
779
|
+
this.context ??= new HttpContext();
|
|
785
780
|
// If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
|
|
786
781
|
if (!this.params) {
|
|
787
782
|
this.params = new HttpParams();
|
|
@@ -804,7 +799,7 @@ class HttpRequest {
|
|
|
804
799
|
// 3) '?' exists at the end of the url -> append params directly.
|
|
805
800
|
// This basically amounts to determining the character, if any, with
|
|
806
801
|
// which to join the URL and parameters.
|
|
807
|
-
const sep = qIdx === -1 ? '?' :
|
|
802
|
+
const sep = qIdx === -1 ? '?' : qIdx < url.length - 1 ? '&' : '';
|
|
808
803
|
this.urlWithParams = url + sep + params;
|
|
809
804
|
}
|
|
810
805
|
}
|
|
@@ -820,8 +815,11 @@ class HttpRequest {
|
|
|
820
815
|
}
|
|
821
816
|
// Check whether the body is already in a serialized form. If so,
|
|
822
817
|
// it can just be returned directly.
|
|
823
|
-
if (isArrayBuffer(this.body) ||
|
|
824
|
-
|
|
818
|
+
if (isArrayBuffer(this.body) ||
|
|
819
|
+
isBlob(this.body) ||
|
|
820
|
+
isFormData(this.body) ||
|
|
821
|
+
isUrlSearchParams(this.body) ||
|
|
822
|
+
typeof this.body === 'string') {
|
|
825
823
|
return this.body;
|
|
826
824
|
}
|
|
827
825
|
// Check whether the body is an instance of HttpUrlEncodedParams.
|
|
@@ -829,7 +827,8 @@ class HttpRequest {
|
|
|
829
827
|
return this.body.toString();
|
|
830
828
|
}
|
|
831
829
|
// Check whether the body is an object or array, and serialize with JSON if so.
|
|
832
|
-
if (typeof this.body === 'object' ||
|
|
830
|
+
if (typeof this.body === 'object' ||
|
|
831
|
+
typeof this.body === 'boolean' ||
|
|
833
832
|
Array.isArray(this.body)) {
|
|
834
833
|
return JSON.stringify(this.body);
|
|
835
834
|
}
|
|
@@ -870,7 +869,8 @@ class HttpRequest {
|
|
|
870
869
|
return 'application/x-www-form-urlencoded;charset=UTF-8';
|
|
871
870
|
}
|
|
872
871
|
// Arrays, objects, boolean and numbers will be encoded as JSON.
|
|
873
|
-
if (typeof this.body === 'object' ||
|
|
872
|
+
if (typeof this.body === 'object' ||
|
|
873
|
+
typeof this.body === 'number' ||
|
|
874
874
|
typeof this.body === 'boolean') {
|
|
875
875
|
return 'application/json';
|
|
876
876
|
}
|
|
@@ -887,11 +887,11 @@ class HttpRequest {
|
|
|
887
887
|
// whatever current body is present is being overridden with an empty
|
|
888
888
|
// body, whereas an `undefined` value in update.body implies no
|
|
889
889
|
// override.
|
|
890
|
-
const body =
|
|
890
|
+
const body = update.body !== undefined ? update.body : this.body;
|
|
891
891
|
// Carefully handle the boolean options to differentiate between
|
|
892
892
|
// `false` and `undefined` in the update args.
|
|
893
|
-
const withCredentials =
|
|
894
|
-
const reportProgress =
|
|
893
|
+
const withCredentials = update.withCredentials !== undefined ? update.withCredentials : this.withCredentials;
|
|
894
|
+
const reportProgress = update.reportProgress !== undefined ? update.reportProgress : this.reportProgress;
|
|
895
895
|
// Headers and params may be appended to if `setHeaders` or
|
|
896
896
|
// `setParams` are used.
|
|
897
897
|
let headers = update.headers || this.headers;
|
|
@@ -901,15 +901,12 @@ class HttpRequest {
|
|
|
901
901
|
// Check whether the caller has asked to add headers.
|
|
902
902
|
if (update.setHeaders !== undefined) {
|
|
903
903
|
// Set every requested header.
|
|
904
|
-
headers =
|
|
905
|
-
Object.keys(update.setHeaders)
|
|
906
|
-
.reduce((headers, name) => headers.set(name, update.setHeaders[name]), headers);
|
|
904
|
+
headers = Object.keys(update.setHeaders).reduce((headers, name) => headers.set(name, update.setHeaders[name]), headers);
|
|
907
905
|
}
|
|
908
906
|
// Check whether the caller has asked to set params.
|
|
909
907
|
if (update.setParams) {
|
|
910
908
|
// Set every requested param.
|
|
911
|
-
params = Object.keys(update.setParams)
|
|
912
|
-
.reduce((params, param) => params.set(param, update.setParams[param]), params);
|
|
909
|
+
params = Object.keys(update.setParams).reduce((params, param) => params.set(param, update.setParams[param]), params);
|
|
913
910
|
}
|
|
914
911
|
// Finally, construct the new HttpRequest using the pieces from above.
|
|
915
912
|
return new HttpRequest(method, url, body, {
|
|
@@ -1032,9 +1029,9 @@ class HttpResponse extends HttpResponseBase {
|
|
|
1032
1029
|
}
|
|
1033
1030
|
clone(update = {}) {
|
|
1034
1031
|
return new HttpResponse({
|
|
1035
|
-
body:
|
|
1032
|
+
body: update.body !== undefined ? update.body : this.body,
|
|
1036
1033
|
headers: update.headers || this.headers,
|
|
1037
|
-
status:
|
|
1034
|
+
status: update.status !== undefined ? update.status : this.status,
|
|
1038
1035
|
statusText: update.statusText || this.statusText,
|
|
1039
1036
|
url: update.url || this.url || undefined,
|
|
1040
1037
|
});
|
|
@@ -1285,7 +1282,7 @@ class HttpClient {
|
|
|
1285
1282
|
}
|
|
1286
1283
|
}
|
|
1287
1284
|
// Construct the request.
|
|
1288
|
-
req = new HttpRequest(first, url,
|
|
1285
|
+
req = new HttpRequest(first, url, options.body !== undefined ? options.body : null, {
|
|
1289
1286
|
headers,
|
|
1290
1287
|
context: options.context,
|
|
1291
1288
|
params,
|
|
@@ -1310,7 +1307,7 @@ class HttpClient {
|
|
|
1310
1307
|
// The requested stream contains either the full response or the body. In either
|
|
1311
1308
|
// case, the first step is to filter the event stream to extract a stream of
|
|
1312
1309
|
// responses(s).
|
|
1313
|
-
const res$ = events$.pipe(filter((event) => event instanceof HttpResponse));
|
|
1310
|
+
const res$ = (events$.pipe(filter((event) => event instanceof HttpResponse)));
|
|
1314
1311
|
// Decide which stream to return.
|
|
1315
1312
|
switch (options.observe || 'body') {
|
|
1316
1313
|
case 'body':
|
|
@@ -1448,10 +1445,10 @@ class HttpClient {
|
|
|
1448
1445
|
put(url, body, options = {}) {
|
|
1449
1446
|
return this.request('PUT', url, addBody(options, body));
|
|
1450
1447
|
}
|
|
1451
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1452
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
1448
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1449
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClient }); }
|
|
1453
1450
|
}
|
|
1454
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClient, decorators: [{
|
|
1455
1452
|
type: Injectable
|
|
1456
1453
|
}], ctorParameters: () => [{ type: HttpHandler }] });
|
|
1457
1454
|
|
|
@@ -1487,10 +1484,9 @@ class FetchBackend {
|
|
|
1487
1484
|
this.ngZone = inject(NgZone);
|
|
1488
1485
|
}
|
|
1489
1486
|
handle(request) {
|
|
1490
|
-
return new Observable(observer => {
|
|
1487
|
+
return new Observable((observer) => {
|
|
1491
1488
|
const aborter = new AbortController();
|
|
1492
|
-
this.doRequest(request, aborter.signal, observer)
|
|
1493
|
-
.then(noop, error => observer.error(new HttpErrorResponse({ error })));
|
|
1489
|
+
this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({ error })));
|
|
1494
1490
|
return () => aborter.abort();
|
|
1495
1491
|
});
|
|
1496
1492
|
}
|
|
@@ -1548,9 +1544,11 @@ class FetchBackend {
|
|
|
1548
1544
|
chunks.push(value);
|
|
1549
1545
|
receivedLength += value.length;
|
|
1550
1546
|
if (request.reportProgress) {
|
|
1551
|
-
partialText =
|
|
1552
|
-
|
|
1553
|
-
|
|
1547
|
+
partialText =
|
|
1548
|
+
request.responseType === 'text'
|
|
1549
|
+
? (partialText ?? '') +
|
|
1550
|
+
(decoder ??= new TextDecoder()).decode(value, { stream: true })
|
|
1551
|
+
: undefined;
|
|
1554
1552
|
const reportProgress = () => observer.next({
|
|
1555
1553
|
type: HttpEventType.DownloadProgress,
|
|
1556
1554
|
total: contentLength ? +contentLength : undefined,
|
|
@@ -1656,10 +1654,10 @@ class FetchBackend {
|
|
|
1656
1654
|
}
|
|
1657
1655
|
return chunksAll;
|
|
1658
1656
|
}
|
|
1659
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1660
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
1657
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1658
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: FetchBackend }); }
|
|
1661
1659
|
}
|
|
1662
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: FetchBackend, decorators: [{
|
|
1663
1661
|
type: Injectable
|
|
1664
1662
|
}] });
|
|
1665
1663
|
/**
|
|
@@ -1696,7 +1694,7 @@ function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
|
|
|
1696
1694
|
*/
|
|
1697
1695
|
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
|
|
1698
1696
|
// clang-format off
|
|
1699
|
-
return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, downstreamRequest => chainTailFn(downstreamRequest, finalHandlerFn)));
|
|
1697
|
+
return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));
|
|
1700
1698
|
// clang-format on
|
|
1701
1699
|
}
|
|
1702
1700
|
/**
|
|
@@ -1762,8 +1760,10 @@ class HttpInterceptorHandler extends HttpHandler {
|
|
|
1762
1760
|
const isServer = isPlatformServer(injector.get(PLATFORM_ID));
|
|
1763
1761
|
if (isServer && !(this.backend instanceof FetchBackend)) {
|
|
1764
1762
|
fetchBackendWarningDisplayed = true;
|
|
1765
|
-
injector
|
|
1766
|
-
|
|
1763
|
+
injector
|
|
1764
|
+
.get(ɵConsole)
|
|
1765
|
+
.warn(ɵformatRuntimeError(2801 /* RuntimeErrorCode.NOT_USING_FETCH_BACKEND_IN_SSR */, 'Angular detected that `HttpClient` is not configured ' +
|
|
1766
|
+
"to use `fetch` APIs. It's strongly recommended to " +
|
|
1767
1767
|
'enable `fetch` for applications that use Server-Side Rendering ' +
|
|
1768
1768
|
'for better performance and compatibility. ' +
|
|
1769
1769
|
'To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` ' +
|
|
@@ -1784,13 +1784,12 @@ class HttpInterceptorHandler extends HttpHandler {
|
|
|
1784
1784
|
this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
|
|
1785
1785
|
}
|
|
1786
1786
|
const taskId = this.pendingTasks.add();
|
|
1787
|
-
return this.chain(initialRequest, downstreamRequest => this.backend.handle(downstreamRequest))
|
|
1788
|
-
.pipe(finalize(() => this.pendingTasks.remove(taskId)));
|
|
1787
|
+
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(() => this.pendingTasks.remove(taskId)));
|
|
1789
1788
|
}
|
|
1790
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1791
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
1789
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1790
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpInterceptorHandler }); }
|
|
1792
1791
|
}
|
|
1793
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
|
|
1794
1793
|
type: Injectable
|
|
1795
1794
|
}], ctorParameters: () => [{ type: HttpBackend }, { type: i0.EnvironmentInjector }] });
|
|
1796
1795
|
|
|
@@ -1987,15 +1986,13 @@ class JsonpClientBackend {
|
|
|
1987
1986
|
// Issue #34818
|
|
1988
1987
|
// Changing <script>'s ownerDocument will prevent it from execution.
|
|
1989
1988
|
// https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
|
|
1990
|
-
|
|
1991
|
-
foreignDocument = this.document.implementation.createHTMLDocument();
|
|
1992
|
-
}
|
|
1989
|
+
foreignDocument ??= this.document.implementation.createHTMLDocument();
|
|
1993
1990
|
foreignDocument.adoptNode(script);
|
|
1994
1991
|
}
|
|
1995
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1996
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
1992
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1993
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpClientBackend }); }
|
|
1997
1994
|
}
|
|
1998
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1995
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpClientBackend, decorators: [{
|
|
1999
1996
|
type: Injectable
|
|
2000
1997
|
}], ctorParameters: () => [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
|
|
2001
1998
|
type: Inject,
|
|
@@ -2031,12 +2028,12 @@ class JsonpInterceptor {
|
|
|
2031
2028
|
* @returns An observable of the event stream.
|
|
2032
2029
|
*/
|
|
2033
2030
|
intercept(initialRequest, next) {
|
|
2034
|
-
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
2031
|
+
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
2035
2032
|
}
|
|
2036
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2037
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
2033
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2034
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpInterceptor }); }
|
|
2038
2035
|
}
|
|
2039
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: JsonpInterceptor, decorators: [{
|
|
2040
2037
|
type: Injectable
|
|
2041
2038
|
}], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
|
|
2042
2039
|
|
|
@@ -2081,7 +2078,9 @@ class HttpXhrBackend {
|
|
|
2081
2078
|
// for various non-browser environments. We currently limit it to only `ServerXhr`
|
|
2082
2079
|
// class, which needs to load an XHR implementation.
|
|
2083
2080
|
const xhrFactory = this.xhrFactory;
|
|
2084
|
-
const source = xhrFactory.ɵloadImpl
|
|
2081
|
+
const source = xhrFactory.ɵloadImpl
|
|
2082
|
+
? from(xhrFactory.ɵloadImpl())
|
|
2083
|
+
: of(null);
|
|
2085
2084
|
return source.pipe(switchMap(() => {
|
|
2086
2085
|
// Everything happens on Observable subscription.
|
|
2087
2086
|
return new Observable((observer) => {
|
|
@@ -2114,7 +2113,7 @@ class HttpXhrBackend {
|
|
|
2114
2113
|
// xhr.response will be null, and xhr.responseText cannot be accessed to
|
|
2115
2114
|
// retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON
|
|
2116
2115
|
// is parsed by first requesting text and then applying JSON.parse.
|
|
2117
|
-
xhr.responseType = (
|
|
2116
|
+
xhr.responseType = (responseType !== 'json' ? responseType : 'text');
|
|
2118
2117
|
}
|
|
2119
2118
|
// Serialize the request body if one is present. If not, this will be set to null.
|
|
2120
2119
|
const reqBody = req.serializeBody();
|
|
@@ -2138,8 +2137,7 @@ class HttpXhrBackend {
|
|
|
2138
2137
|
// request URL.
|
|
2139
2138
|
const url = getResponseUrl(xhr) || req.url;
|
|
2140
2139
|
// Construct the HttpHeaderResponse and memoize it.
|
|
2141
|
-
headerResponse =
|
|
2142
|
-
new HttpHeaderResponse({ headers, status: xhr.status, statusText, url });
|
|
2140
|
+
headerResponse = new HttpHeaderResponse({ headers, status: xhr.status, statusText, url });
|
|
2143
2141
|
return headerResponse;
|
|
2144
2142
|
};
|
|
2145
2143
|
// Next, a few closures are defined for the various events which XMLHttpRequest can
|
|
@@ -2152,7 +2150,7 @@ class HttpXhrBackend {
|
|
|
2152
2150
|
let body = null;
|
|
2153
2151
|
if (status !== HttpStatusCode.NoContent) {
|
|
2154
2152
|
// Use XMLHttpRequest.response if set, responseText otherwise.
|
|
2155
|
-
body =
|
|
2153
|
+
body = typeof xhr.response === 'undefined' ? xhr.responseText : xhr.response;
|
|
2156
2154
|
}
|
|
2157
2155
|
// Normalize another potential bug (this one comes from CORS).
|
|
2158
2156
|
if (status === 0) {
|
|
@@ -2315,21 +2313,21 @@ class HttpXhrBackend {
|
|
|
2315
2313
|
});
|
|
2316
2314
|
}));
|
|
2317
2315
|
}
|
|
2318
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2319
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
2316
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXhrBackend, deps: [{ token: i1.XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2317
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXhrBackend }); }
|
|
2320
2318
|
}
|
|
2321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXhrBackend, decorators: [{
|
|
2322
2320
|
type: Injectable
|
|
2323
2321
|
}], ctorParameters: () => [{ type: i1.XhrFactory }] });
|
|
2324
2322
|
|
|
2325
|
-
const XSRF_ENABLED = new InjectionToken('XSRF_ENABLED');
|
|
2323
|
+
const XSRF_ENABLED = new InjectionToken(ngDevMode ? 'XSRF_ENABLED' : '');
|
|
2326
2324
|
const XSRF_DEFAULT_COOKIE_NAME = 'XSRF-TOKEN';
|
|
2327
|
-
const XSRF_COOKIE_NAME = new InjectionToken('XSRF_COOKIE_NAME', {
|
|
2325
|
+
const XSRF_COOKIE_NAME = new InjectionToken(ngDevMode ? 'XSRF_COOKIE_NAME' : '', {
|
|
2328
2326
|
providedIn: 'root',
|
|
2329
2327
|
factory: () => XSRF_DEFAULT_COOKIE_NAME,
|
|
2330
2328
|
});
|
|
2331
2329
|
const XSRF_DEFAULT_HEADER_NAME = 'X-XSRF-TOKEN';
|
|
2332
|
-
const XSRF_HEADER_NAME = new InjectionToken('XSRF_HEADER_NAME', {
|
|
2330
|
+
const XSRF_HEADER_NAME = new InjectionToken(ngDevMode ? 'XSRF_HEADER_NAME' : '', {
|
|
2333
2331
|
providedIn: 'root',
|
|
2334
2332
|
factory: () => XSRF_DEFAULT_HEADER_NAME,
|
|
2335
2333
|
});
|
|
@@ -2367,10 +2365,10 @@ class HttpXsrfCookieExtractor {
|
|
|
2367
2365
|
}
|
|
2368
2366
|
return this.lastToken;
|
|
2369
2367
|
}
|
|
2370
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2371
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
2368
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2369
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfCookieExtractor }); }
|
|
2372
2370
|
}
|
|
2373
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
|
|
2374
2372
|
type: Injectable
|
|
2375
2373
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2376
2374
|
type: Inject,
|
|
@@ -2388,8 +2386,11 @@ function xsrfInterceptorFn(req, next) {
|
|
|
2388
2386
|
// Non-mutating requests don't require a token, and absolute URLs require special handling
|
|
2389
2387
|
// anyway as the cookie set
|
|
2390
2388
|
// on our origin is not the same as the token expected by another origin.
|
|
2391
|
-
if (!inject(XSRF_ENABLED) ||
|
|
2392
|
-
|
|
2389
|
+
if (!inject(XSRF_ENABLED) ||
|
|
2390
|
+
req.method === 'GET' ||
|
|
2391
|
+
req.method === 'HEAD' ||
|
|
2392
|
+
lcUrl.startsWith('http://') ||
|
|
2393
|
+
lcUrl.startsWith('https://')) {
|
|
2393
2394
|
return next(req);
|
|
2394
2395
|
}
|
|
2395
2396
|
const token = inject(HttpXsrfTokenExtractor).getToken();
|
|
@@ -2408,12 +2409,12 @@ class HttpXsrfInterceptor {
|
|
|
2408
2409
|
this.injector = injector;
|
|
2409
2410
|
}
|
|
2410
2411
|
intercept(initialRequest, next) {
|
|
2411
|
-
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, downstreamRequest => next.handle(downstreamRequest)));
|
|
2412
|
+
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
2412
2413
|
}
|
|
2413
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2414
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.
|
|
2414
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2415
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfInterceptor }); }
|
|
2415
2416
|
}
|
|
2416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2417
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
|
|
2417
2418
|
type: Injectable
|
|
2418
2419
|
}], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
|
|
2419
2420
|
|
|
@@ -2469,12 +2470,12 @@ function makeHttpFeature(kind, providers) {
|
|
|
2469
2470
|
*/
|
|
2470
2471
|
function provideHttpClient(...features) {
|
|
2471
2472
|
if (ngDevMode) {
|
|
2472
|
-
const featureKinds = new Set(features.map(f => f.ɵkind));
|
|
2473
|
+
const featureKinds = new Set(features.map((f) => f.ɵkind));
|
|
2473
2474
|
if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) &&
|
|
2474
2475
|
featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
|
|
2475
|
-
throw new Error(ngDevMode
|
|
2476
|
-
`Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.`
|
|
2477
|
-
'');
|
|
2476
|
+
throw new Error(ngDevMode
|
|
2477
|
+
? `Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.`
|
|
2478
|
+
: '');
|
|
2478
2479
|
}
|
|
2479
2480
|
}
|
|
2480
2481
|
const providers = [
|
|
@@ -2505,7 +2506,7 @@ function provideHttpClient(...features) {
|
|
|
2505
2506
|
* @publicApi
|
|
2506
2507
|
*/
|
|
2507
2508
|
function withInterceptors(interceptorFns) {
|
|
2508
|
-
return makeHttpFeature(HttpFeatureKind.Interceptors, interceptorFns.map(interceptorFn => {
|
|
2509
|
+
return makeHttpFeature(HttpFeatureKind.Interceptors, interceptorFns.map((interceptorFn) => {
|
|
2509
2510
|
return {
|
|
2510
2511
|
provide: HTTP_INTERCEPTOR_FNS,
|
|
2511
2512
|
useValue: interceptorFn,
|
|
@@ -2513,7 +2514,7 @@ function withInterceptors(interceptorFns) {
|
|
|
2513
2514
|
};
|
|
2514
2515
|
}));
|
|
2515
2516
|
}
|
|
2516
|
-
const LEGACY_INTERCEPTOR_FN = new InjectionToken('LEGACY_INTERCEPTOR_FN');
|
|
2517
|
+
const LEGACY_INTERCEPTOR_FN = new InjectionToken(ngDevMode ? 'LEGACY_INTERCEPTOR_FN' : '');
|
|
2517
2518
|
/**
|
|
2518
2519
|
* Includes class-based interceptors configured using a multi-provider in the current injector into
|
|
2519
2520
|
* the configured `HttpClient` instance.
|
|
@@ -2540,7 +2541,7 @@ function withInterceptorsFromDi() {
|
|
|
2540
2541
|
provide: HTTP_INTERCEPTOR_FNS,
|
|
2541
2542
|
useExisting: LEGACY_INTERCEPTOR_FN,
|
|
2542
2543
|
multi: true,
|
|
2543
|
-
}
|
|
2544
|
+
},
|
|
2544
2545
|
]);
|
|
2545
2546
|
}
|
|
2546
2547
|
/**
|
|
@@ -2550,7 +2551,7 @@ function withInterceptorsFromDi() {
|
|
|
2550
2551
|
*
|
|
2551
2552
|
* @see {@link provideHttpClient}
|
|
2552
2553
|
*/
|
|
2553
|
-
function withXsrfConfiguration({ cookieName, headerName }) {
|
|
2554
|
+
function withXsrfConfiguration({ cookieName, headerName, }) {
|
|
2554
2555
|
const providers = [];
|
|
2555
2556
|
if (cookieName !== undefined) {
|
|
2556
2557
|
providers.push({ provide: XSRF_COOKIE_NAME, useValue: cookieName });
|
|
@@ -2664,9 +2665,7 @@ class HttpClientXsrfModule {
|
|
|
2664
2665
|
static disable() {
|
|
2665
2666
|
return {
|
|
2666
2667
|
ngModule: HttpClientXsrfModule,
|
|
2667
|
-
providers: [
|
|
2668
|
-
withNoXsrfProtection().ɵproviders,
|
|
2669
|
-
],
|
|
2668
|
+
providers: [withNoXsrfProtection().ɵproviders],
|
|
2670
2669
|
};
|
|
2671
2670
|
}
|
|
2672
2671
|
/**
|
|
@@ -2683,9 +2682,9 @@ class HttpClientXsrfModule {
|
|
|
2683
2682
|
providers: withXsrfConfiguration(options).ɵproviders,
|
|
2684
2683
|
};
|
|
2685
2684
|
}
|
|
2686
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2687
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.
|
|
2688
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.
|
|
2685
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2686
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: HttpClientXsrfModule }); }
|
|
2687
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientXsrfModule, providers: [
|
|
2689
2688
|
HttpXsrfInterceptor,
|
|
2690
2689
|
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
|
|
2691
2690
|
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
@@ -2696,7 +2695,7 @@ class HttpClientXsrfModule {
|
|
|
2696
2695
|
{ provide: XSRF_ENABLED, useValue: true },
|
|
2697
2696
|
] }); }
|
|
2698
2697
|
}
|
|
2699
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2698
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
|
|
2700
2699
|
type: NgModule,
|
|
2701
2700
|
args: [{
|
|
2702
2701
|
providers: [
|
|
@@ -2721,22 +2720,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImpor
|
|
|
2721
2720
|
* @publicApi
|
|
2722
2721
|
*/
|
|
2723
2722
|
class HttpClientModule {
|
|
2724
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2725
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.
|
|
2726
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.
|
|
2727
|
-
provideHttpClient(withInterceptorsFromDi()),
|
|
2728
|
-
] }); }
|
|
2723
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2724
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: HttpClientModule }); }
|
|
2725
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] }); }
|
|
2729
2726
|
}
|
|
2730
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2727
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientModule, decorators: [{
|
|
2731
2728
|
type: NgModule,
|
|
2732
2729
|
args: [{
|
|
2733
2730
|
/**
|
|
2734
2731
|
* Configures the [dependency injector](guide/glossary#injector) where it is imported
|
|
2735
2732
|
* with supporting services for HTTP communications.
|
|
2736
2733
|
*/
|
|
2737
|
-
providers: [
|
|
2738
|
-
provideHttpClient(withInterceptorsFromDi()),
|
|
2739
|
-
],
|
|
2734
|
+
providers: [provideHttpClient(withInterceptorsFromDi())],
|
|
2740
2735
|
}]
|
|
2741
2736
|
}] });
|
|
2742
2737
|
/**
|
|
@@ -2748,18 +2743,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImpor
|
|
|
2748
2743
|
* @publicApi
|
|
2749
2744
|
*/
|
|
2750
2745
|
class HttpClientJsonpModule {
|
|
2751
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
2752
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.
|
|
2753
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.
|
|
2754
|
-
withJsonpSupport().ɵproviders,
|
|
2755
|
-
] }); }
|
|
2746
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2747
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: HttpClientJsonpModule }); }
|
|
2748
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] }); }
|
|
2756
2749
|
}
|
|
2757
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
2750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
|
|
2758
2751
|
type: NgModule,
|
|
2759
2752
|
args: [{
|
|
2760
|
-
providers: [
|
|
2761
|
-
withJsonpSupport().ɵproviders,
|
|
2762
|
-
],
|
|
2753
|
+
providers: [withJsonpSupport().ɵproviders],
|
|
2763
2754
|
}]
|
|
2764
2755
|
}] });
|
|
2765
2756
|
|
|
@@ -2786,7 +2777,7 @@ function transferCacheInterceptorFn(req, next) {
|
|
|
2786
2777
|
(requestMethod === 'POST' && !globalOptions.includePostRequests && !requestOptions) ||
|
|
2787
2778
|
(requestMethod !== 'POST' && !ALLOWED_METHODS.includes(requestMethod)) ||
|
|
2788
2779
|
requestOptions === false || //
|
|
2789
|
-
|
|
2780
|
+
globalOptions.filter?.(req) === false) {
|
|
2790
2781
|
return next(req);
|
|
2791
2782
|
}
|
|
2792
2783
|
const transferState = inject(TransferState);
|
|
@@ -2798,7 +2789,7 @@ function transferCacheInterceptorFn(req, next) {
|
|
|
2798
2789
|
headersToInclude = requestOptions.includeHeaders;
|
|
2799
2790
|
}
|
|
2800
2791
|
if (response) {
|
|
2801
|
-
const { [BODY]: undecodedBody, [RESPONSE_TYPE]: responseType, [HEADERS]: httpHeaders, [STATUS]: status, [STATUS_TEXT]: statusText, [URL]: url } = response;
|
|
2792
|
+
const { [BODY]: undecodedBody, [RESPONSE_TYPE]: responseType, [HEADERS]: httpHeaders, [STATUS]: status, [STATUS_TEXT]: statusText, [URL]: url, } = response;
|
|
2802
2793
|
// Request found in cache. Respond using it.
|
|
2803
2794
|
let body = undecodedBody;
|
|
2804
2795
|
switch (responseType) {
|
|
@@ -2857,7 +2848,11 @@ function getFilteredHeaders(headers, includeHeaders) {
|
|
|
2857
2848
|
function makeCacheKey(request) {
|
|
2858
2849
|
// make the params encoded same as a url so it's easy to identify
|
|
2859
2850
|
const { params, method, responseType, url } = request;
|
|
2860
|
-
const encodedParams = params
|
|
2851
|
+
const encodedParams = params
|
|
2852
|
+
.keys()
|
|
2853
|
+
.sort()
|
|
2854
|
+
.map((k) => `${k}=${params.getAll(k)}`)
|
|
2855
|
+
.join('&');
|
|
2861
2856
|
const key = method + '.' + responseType + '.' + url + '?' + encodedParams;
|
|
2862
2857
|
const hash = generateHash(key);
|
|
2863
2858
|
return makeStateKey(hash);
|
|
@@ -2871,7 +2866,7 @@ function makeCacheKey(request) {
|
|
|
2871
2866
|
function generateHash(value) {
|
|
2872
2867
|
let hash = 0;
|
|
2873
2868
|
for (const char of value) {
|
|
2874
|
-
hash = Math.imul(31, hash) + char.charCodeAt(0) << 0;
|
|
2869
|
+
hash = (Math.imul(31, hash) + char.charCodeAt(0)) << 0;
|
|
2875
2870
|
}
|
|
2876
2871
|
// Force positive number hash.
|
|
2877
2872
|
// 2147483647 = equivalent of Integer.MAX_VALUE.
|
|
@@ -2896,13 +2891,13 @@ function withHttpTransferCache(cacheOptions) {
|
|
|
2896
2891
|
useFactory: () => {
|
|
2897
2892
|
ɵperformanceMarkFeature('NgHttpTransferCache');
|
|
2898
2893
|
return { isCacheActive: true, ...cacheOptions };
|
|
2899
|
-
}
|
|
2894
|
+
},
|
|
2900
2895
|
},
|
|
2901
2896
|
{
|
|
2902
2897
|
provide: HTTP_ROOT_INTERCEPTOR_FNS,
|
|
2903
2898
|
useValue: transferCacheInterceptorFn,
|
|
2904
2899
|
multi: true,
|
|
2905
|
-
deps: [TransferState, CACHE_OPTIONS]
|
|
2900
|
+
deps: [TransferState, CACHE_OPTIONS],
|
|
2906
2901
|
},
|
|
2907
2902
|
{
|
|
2908
2903
|
provide: APP_BOOTSTRAP_LISTENER,
|
|
@@ -2915,8 +2910,8 @@ function withHttpTransferCache(cacheOptions) {
|
|
|
2915
2910
|
cacheState.isCacheActive = false;
|
|
2916
2911
|
});
|
|
2917
2912
|
};
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2913
|
+
},
|
|
2914
|
+
},
|
|
2920
2915
|
];
|
|
2921
2916
|
}
|
|
2922
2917
|
/**
|
|
@@ -2950,7 +2945,7 @@ function appendMissingHeadersDetection(url, headers, headersToInclude) {
|
|
|
2950
2945
|
// invoking the original method
|
|
2951
2946
|
return value.apply(target, [headerName]);
|
|
2952
2947
|
};
|
|
2953
|
-
}
|
|
2948
|
+
},
|
|
2954
2949
|
});
|
|
2955
2950
|
}
|
|
2956
2951
|
|