From 91cdc11aa0347d1b71f2f732e00af9c3ff8078fc Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Tue, 2 Feb 2021 08:10:50 +0100 Subject: [PATCH] fix(common): allow number or boolean as http params (#40663) This change fixes an incompatibility between the old `@angular/http` package and its successor (`@angular/common/http`) by re-introducing the types that were supported before. It now allows to use number and boolean directly as HTTP params, instead of having to convert it to string first. Before: this.http.get('/api/config', { params: { page: `${page}` } }); After: this.http.get('/api/config', { params: { page }}); `HttpParams` has also been updated to have most of its methods accept number or boolean values. Fixes #23856 BREAKING CHANGE: The methods of the `HttpParams` class now accept `string | number | boolean` instead of `string` for the value of a parameter. If you extended this class in your application, you'll have to update the signatures of your methods to reflect these changes. PR Close #40663 --- aio/content/guide/http.md | 2 +- goldens/public-api/common/http/http.d.ts | 252 +++++++-------- packages/common/http/src/client.ts | 391 +++++++++++++++-------- packages/common/http/src/params.ts | 22 +- packages/common/http/test/client_spec.ts | 26 +- packages/common/http/test/params_spec.ts | 108 ++++++- 6 files changed, 529 insertions(+), 272 deletions(-) diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 48c57fc69a..87ffcca7aa 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -72,7 +72,7 @@ The `get()` method takes two arguments; the endpoint URL from which to fetch, an options: { headers?: HttpHeaders | {[header: string]: string | string[]}, observe?: 'body' | 'events' | 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams|{[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, diff --git a/goldens/public-api/common/http/http.d.ts b/goldens/public-api/common/http/http.d.ts index 97865565b7..0b6c33c7a6 100644 --- a/goldens/public-api/common/http/http.d.ts +++ b/goldens/public-api/common/http/http.d.ts @@ -12,7 +12,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -24,7 +24,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -36,7 +36,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -48,7 +48,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -60,7 +60,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -72,7 +72,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -84,7 +84,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -96,7 +96,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | (string | number | boolean)[]; }; reportProgress?: boolean; responseType?: 'json'; @@ -108,7 +108,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -120,7 +120,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -132,7 +132,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -144,7 +144,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -156,7 +156,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -168,7 +168,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -180,7 +180,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -192,7 +192,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -204,7 +204,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -216,7 +216,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -228,7 +228,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -240,7 +240,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -252,7 +252,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -264,7 +264,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -276,7 +276,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -288,7 +288,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -300,7 +300,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -312,7 +312,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -324,7 +324,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -336,7 +336,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -348,7 +348,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -360,7 +360,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -372,7 +372,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -384,7 +384,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -396,7 +396,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -408,7 +408,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -420,7 +420,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -432,7 +432,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -444,7 +444,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -456,7 +456,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -468,7 +468,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -480,7 +480,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -492,7 +492,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -504,7 +504,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -516,7 +516,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -528,7 +528,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -540,7 +540,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -554,7 +554,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -566,7 +566,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -578,7 +578,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -590,7 +590,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -602,7 +602,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -614,7 +614,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -626,7 +626,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -638,7 +638,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -650,7 +650,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -662,7 +662,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -674,7 +674,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -686,7 +686,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -698,7 +698,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -710,7 +710,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -722,7 +722,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -734,7 +734,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -746,7 +746,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -758,7 +758,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -770,7 +770,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -782,7 +782,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -794,7 +794,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -806,7 +806,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -818,7 +818,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -830,7 +830,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -842,7 +842,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -854,7 +854,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -866,7 +866,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -878,7 +878,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -890,7 +890,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -902,7 +902,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -914,7 +914,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -926,7 +926,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -938,7 +938,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -950,7 +950,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -962,7 +962,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -974,7 +974,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -986,7 +986,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -998,7 +998,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1010,7 +1010,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1022,7 +1022,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1034,7 +1034,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1046,7 +1046,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1058,7 +1058,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1070,7 +1070,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1082,7 +1082,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1094,7 +1094,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1106,7 +1106,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1118,7 +1118,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1130,7 +1130,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1142,7 +1142,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1154,7 +1154,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1166,7 +1166,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1178,7 +1178,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1190,7 +1190,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1202,7 +1202,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1214,7 +1214,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1226,7 +1226,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1238,7 +1238,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1250,7 +1250,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1262,7 +1262,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType?: 'json'; @@ -1276,7 +1276,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1289,7 +1289,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1302,7 +1302,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1314,7 +1314,7 @@ export declare class HttpClient { [header: string]: string | string[]; }; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; observe: 'events'; reportProgress?: boolean; @@ -1328,7 +1328,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1341,7 +1341,7 @@ export declare class HttpClient { }; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1355,7 +1355,7 @@ export declare class HttpClient { reportProgress?: boolean; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; withCredentials?: boolean; @@ -1368,7 +1368,7 @@ export declare class HttpClient { reportProgress?: boolean; observe: 'events'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; withCredentials?: boolean; @@ -1380,7 +1380,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'arraybuffer'; @@ -1393,7 +1393,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'blob'; @@ -1406,7 +1406,7 @@ export declare class HttpClient { }; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: 'text'; @@ -1420,7 +1420,7 @@ export declare class HttpClient { reportProgress?: boolean; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; withCredentials?: boolean; @@ -1433,7 +1433,7 @@ export declare class HttpClient { reportProgress?: boolean; observe: 'response'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; withCredentials?: boolean; @@ -1445,7 +1445,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; reportProgress?: boolean; @@ -1458,7 +1458,7 @@ export declare class HttpClient { }; observe?: 'body'; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; responseType?: 'json'; reportProgress?: boolean; @@ -1470,7 +1470,7 @@ export declare class HttpClient { [header: string]: string | string[]; }; params?: HttpParams | { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }; observe?: 'body' | 'events' | 'response'; reportProgress?: boolean; @@ -1569,23 +1569,23 @@ export declare interface HttpParameterCodec { export declare class HttpParams { constructor(options?: HttpParamsOptions); - append(param: string, value: string): HttpParams; + append(param: string, value: string | number | boolean): HttpParams; appendAll(params: { - [param: string]: string | string[]; + [param: string]: string | number | boolean | ReadonlyArray; }): HttpParams; - delete(param: string, value?: string): HttpParams; + delete(param: string, value?: string | number | boolean): HttpParams; get(param: string): string | null; getAll(param: string): string[] | null; has(param: string): boolean; keys(): string[]; - set(param: string, value: string): HttpParams; + set(param: string, value: string | number | boolean): HttpParams; toString(): string; } export declare interface HttpParamsOptions { encoder?: HttpParameterCodec; fromObject?: { - [param: string]: string | ReadonlyArray; + [param: string]: string | number | boolean | ReadonlyArray; }; fromString?: string; } diff --git a/packages/common/http/src/client.ts b/packages/common/http/src/client.ts index 1761bae22b..3e18131aa3 100644 --- a/packages/common/http/src/client.ts +++ b/packages/common/http/src/client.ts @@ -31,7 +31,8 @@ function addBody( options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -120,7 +121,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -139,7 +141,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -158,7 +161,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -177,7 +181,9 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, - params?: HttpParams|{[param: string]: string | string[]}, observe: 'events', + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, + observe: 'events', reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -196,7 +202,8 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -215,7 +222,8 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -235,7 +243,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, reportProgress?: boolean, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', withCredentials?: boolean, }): Observable>; @@ -255,7 +264,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, reportProgress?: boolean, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', withCredentials?: boolean, }): Observable>; @@ -273,7 +283,8 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -290,7 +301,8 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -308,7 +320,8 @@ export class HttpClient { request(method: string, url: string, options: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -328,7 +341,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, reportProgress?: boolean, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', withCredentials?: boolean, }): Observable>; @@ -347,7 +361,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, reportProgress?: boolean, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', withCredentials?: boolean, }): Observable>; @@ -366,7 +381,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', reportProgress?: boolean, withCredentials?: boolean, @@ -386,7 +402,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, responseType?: 'json', reportProgress?: boolean, withCredentials?: boolean, @@ -404,7 +421,8 @@ export class HttpClient { request(method: string, url: string, options?: { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, observe?: 'body'|'events'|'response', reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', @@ -441,7 +459,8 @@ export class HttpClient { body?: any, headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -565,7 +584,8 @@ export class HttpClient { delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -583,7 +603,8 @@ export class HttpClient { delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -600,7 +621,8 @@ export class HttpClient { delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -617,7 +639,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -634,7 +657,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -651,7 +675,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -668,7 +693,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -686,7 +712,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | (string | number | boolean)[]}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -703,7 +730,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -719,7 +747,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -735,7 +764,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -752,7 +782,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -769,7 +800,8 @@ export class HttpClient { */ delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -787,7 +819,8 @@ export class HttpClient { delete(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -805,7 +838,8 @@ export class HttpClient { delete(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -823,7 +857,8 @@ export class HttpClient { delete(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -844,7 +879,8 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -861,7 +897,8 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -878,7 +915,8 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -895,7 +933,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -911,7 +950,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -927,7 +967,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -943,7 +984,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -960,7 +1002,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -978,7 +1021,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -995,7 +1039,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1012,7 +1057,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1029,7 +1075,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1047,7 +1094,8 @@ export class HttpClient { */ get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1066,7 +1114,8 @@ export class HttpClient { get(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1084,7 +1133,8 @@ export class HttpClient { get(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1098,7 +1148,8 @@ export class HttpClient { get(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -1119,7 +1170,8 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -1137,7 +1189,8 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -1154,7 +1207,8 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -1171,7 +1225,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1188,7 +1243,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1205,7 +1261,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1222,7 +1279,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1240,7 +1298,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1258,7 +1317,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1275,7 +1335,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1292,7 +1353,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1309,7 +1371,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1327,7 +1390,8 @@ export class HttpClient { */ head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1345,7 +1409,8 @@ export class HttpClient { head(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1364,7 +1429,8 @@ export class HttpClient { head(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1380,7 +1446,8 @@ export class HttpClient { head(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -1450,7 +1517,8 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -1467,7 +1535,8 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -1484,7 +1553,8 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -1501,7 +1571,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1518,7 +1589,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1535,7 +1607,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1552,7 +1625,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1570,7 +1644,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1588,7 +1663,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1605,7 +1681,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1622,7 +1699,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1639,7 +1717,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1657,7 +1736,8 @@ export class HttpClient { */ options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1675,7 +1755,8 @@ export class HttpClient { options(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1693,7 +1774,8 @@ export class HttpClient { options(url: string, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1709,7 +1791,8 @@ export class HttpClient { options(url: string, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -1730,7 +1813,8 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -1748,7 +1832,8 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -1766,7 +1851,8 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -1785,7 +1871,8 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1803,7 +1890,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1821,7 +1909,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1839,7 +1928,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1858,7 +1948,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1877,7 +1968,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -1895,7 +1987,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -1913,7 +2006,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -1931,7 +2025,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1950,7 +2045,8 @@ export class HttpClient { */ patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1969,7 +2065,8 @@ export class HttpClient { patch(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -1989,7 +2086,8 @@ export class HttpClient { patch(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2003,7 +2101,8 @@ export class HttpClient { patch(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -2024,7 +2123,8 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -2042,7 +2142,8 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -2060,7 +2161,8 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -2078,7 +2180,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -2095,7 +2198,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -2113,7 +2217,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -2131,7 +2236,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2150,7 +2256,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2169,7 +2276,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -2187,7 +2295,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -2205,7 +2314,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -2223,7 +2333,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2243,7 +2354,8 @@ export class HttpClient { */ post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2262,7 +2374,8 @@ export class HttpClient { post(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2282,7 +2395,8 @@ export class HttpClient { post(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2297,7 +2411,8 @@ export class HttpClient { post(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, @@ -2318,7 +2433,8 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable; @@ -2336,7 +2452,8 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable; @@ -2354,7 +2471,8 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable; @@ -2372,7 +2490,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -2390,7 +2509,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -2408,7 +2528,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -2426,7 +2547,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2445,7 +2567,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'events', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2464,7 +2587,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'arraybuffer', withCredentials?: boolean, }): Observable>; @@ -2482,7 +2606,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'blob', withCredentials?: boolean, }): Observable>; @@ -2500,7 +2625,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType: 'text', withCredentials?: boolean, }): Observable>; @@ -2518,7 +2644,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2537,7 +2664,8 @@ export class HttpClient { */ put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe: 'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2556,7 +2684,8 @@ export class HttpClient { put(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2575,7 +2704,8 @@ export class HttpClient { put(url: string, body: any|null, options?: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'json', withCredentials?: boolean, @@ -2590,7 +2720,8 @@ export class HttpClient { put(url: string, body: any|null, options: { headers?: HttpHeaders|{[header: string]: string | string[]}, observe?: 'body'|'events'|'response', - params?: HttpParams|{[param: string]: string | string[]}, + params?: HttpParams| + {[param: string]: string | number | boolean | ReadonlyArray}, reportProgress?: boolean, responseType?: 'arraybuffer'|'blob'|'json'|'text', withCredentials?: boolean, diff --git a/packages/common/http/src/params.ts b/packages/common/http/src/params.ts index b4841570c8..a9f161eb85 100644 --- a/packages/common/http/src/params.ts +++ b/packages/common/http/src/params.ts @@ -101,10 +101,13 @@ function standardEncoding(v: string): string { .replace(/%3F/gi, '?') .replace(/%2F/gi, '/'); } +function valueToString(value: string|number|boolean): string { + return `${value}`; +} interface Update { param: string; - value?: string; + value?: string|number|boolean; op: 'a'|'d'|'s'; } @@ -121,7 +124,7 @@ export interface HttpParamsOptions { fromString?: string; /** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */ - fromObject?: {[param: string]: string|ReadonlyArray}; + fromObject?: {[param: string]: string|number|boolean|ReadonlyArray}; /** Encoding codec used to parse and serialize the parameters. */ encoder?: HttpParameterCodec; @@ -208,7 +211,7 @@ export class HttpParams { * @param value The new value to add. * @return A new body with the appended value. */ - append(param: string, value: string): HttpParams { + append(param: string, value: string|number|boolean): HttpParams { return this.clone({param, value, op: 'a'}); } @@ -217,7 +220,8 @@ export class HttpParams { * @param params parameters and values * @return A new body with the new value. */ - appendAll(params: {[param: string]: string|string[]}): HttpParams { + appendAll(params: {[param: string]: string|number|boolean|ReadonlyArray}): + HttpParams { const updates: Update[] = []; Object.keys(params).forEach(param => { const value = params[param]; @@ -226,7 +230,7 @@ export class HttpParams { updates.push({param, value: _value, op: 'a'}); }); } else { - updates.push({param, value, op: 'a'}); + updates.push({param, value: value as (string | number | boolean), op: 'a'}); } }); return this.clone(updates); @@ -238,7 +242,7 @@ export class HttpParams { * @param value The new value. * @return A new body with the new value. */ - set(param: string, value: string): HttpParams { + set(param: string, value: string|number|boolean): HttpParams { return this.clone({param, value, op: 's'}); } @@ -249,7 +253,7 @@ export class HttpParams { * @return A new body with the given value removed, or with all values * removed if no value is specified. */ - delete(param: string, value?: string): HttpParams { + delete(param: string, value?: string|number|boolean): HttpParams { return this.clone({param, value, op: 'd'}); } @@ -293,13 +297,13 @@ export class HttpParams { case 'a': case 's': const base = (update.op === 'a' ? this.map!.get(update.param) : undefined) || []; - base.push(update.value!); + base.push(valueToString(update.value!)); this.map!.set(update.param, base); break; case 'd': if (update.value !== undefined) { let base = this.map!.get(update.param) || []; - const idx = base.indexOf(update.value); + const idx = base.indexOf(valueToString(update.value)); if (idx !== -1) { base.splice(idx, 1); } diff --git a/packages/common/http/test/client_spec.ts b/packages/common/http/test/client_spec.ts index d41693b368..a974b76b45 100644 --- a/packages/common/http/test/client_spec.ts +++ b/packages/common/http/test/client_spec.ts @@ -51,10 +51,34 @@ import {toArray} from 'rxjs/operators'; expect(req.request.headers.get('X-Option')).toEqual('true'); req.flush({}); }); - it('with params', done => { + it('with string params', done => { client.get('/test', {params: {'test': 'true'}}).subscribe(() => done()); backend.expectOne('/test?test=true').flush({}); }); + it('with an array of string params', done => { + client.get('/test', {params: {'test': ['a', 'b']}}).subscribe(() => done()); + backend.expectOne('/test?test=a&test=b').flush({}); + }); + it('with number params', done => { + client.get('/test', {params: {'test': 2}}).subscribe(() => done()); + backend.expectOne('/test?test=2').flush({}); + }); + it('with an array of number params', done => { + client.get('/test', {params: {'test': [2, 3]}}).subscribe(() => done()); + backend.expectOne('/test?test=2&test=3').flush({}); + }); + it('with boolean params', done => { + client.get('/test', {params: {'test': true}}).subscribe(() => done()); + backend.expectOne('/test?test=true').flush({}); + }); + it('with an array of boolean params', done => { + client.get('/test', {params: {'test': [true, false]}}).subscribe(() => done()); + backend.expectOne('/test?test=true&test=false').flush({}); + }); + it('with an array of params of different types', done => { + client.get('/test', {params: {'test': [true, 'a', 2] as const}}).subscribe(() => done()); + backend.expectOne('/test?test=true&test=a&test=2').flush({}); + }); it('for an arraybuffer', done => { const body = new ArrayBuffer(4); client.get('/test', {responseType: 'arraybuffer'}).subscribe(res => { diff --git a/packages/common/http/test/params_spec.ts b/packages/common/http/test/params_spec.ts index 60d20421a0..dfd3a208da 100644 --- a/packages/common/http/test/params_spec.ts +++ b/packages/common/http/test/params_spec.ts @@ -37,42 +37,120 @@ import {HttpParams} from '@angular/common/http/src/params'; }); describe('lazy mutation', () => { - it('should allow setting parameters', () => { + it('should allow setting string parameters', () => { const body = new HttpParams({fromString: 'a=b'}); const mutated = body.set('a', 'c'); expect(mutated.toString()).toEqual('a=c'); }); - it('should allow appending parameters', () => { + it('should allow setting number parameters', () => { + const body = new HttpParams({fromString: 'a=b'}); + const mutated = body.set('a', 1); + expect(mutated.toString()).toEqual('a=1'); + }); + + it('should allow setting boolean parameters', () => { + const body = new HttpParams({fromString: 'a=b'}); + const mutated = body.set('a', true); + expect(mutated.toString()).toEqual('a=true'); + }); + + it('should allow appending string parameters', () => { const body = new HttpParams({fromString: 'a=b'}); const mutated = body.append('a', 'c'); expect(mutated.toString()).toEqual('a=b&a=c'); }); - it('should allow appending all parameters', () => { + it('should allow appending number parameters', () => { + const body = new HttpParams({fromString: 'a=b'}); + const mutated = body.append('a', 1); + expect(mutated.toString()).toEqual('a=b&a=1'); + }); + + it('should allow appending boolean parameters', () => { + const body = new HttpParams({fromString: 'a=b'}); + const mutated = body.append('a', true); + expect(mutated.toString()).toEqual('a=b&a=true'); + }); + + it('should allow appending all string parameters', () => { const body = new HttpParams({fromString: 'a=a1&b=b1'}); const mutated = body.appendAll({a: ['a2', 'a3'], b: 'b2'}); expect(mutated.toString()).toEqual('a=a1&a=a2&a=a3&b=b1&b=b2'); }); + it('should allow appending all number parameters', () => { + const body = new HttpParams({fromString: 'a=1&b=b1'}); + const mutated = body.appendAll({a: [2, 3], b: 'b2'}); + expect(mutated.toString()).toEqual('a=1&a=2&a=3&b=b1&b=b2'); + }); + + it('should allow appending all boolean parameters', () => { + const body = new HttpParams({fromString: 'a=true&b=b1'}); + const mutated = body.appendAll({a: [true, false], b: 'b2'}); + expect(mutated.toString()).toEqual('a=true&a=true&a=false&b=b1&b=b2'); + }); + + it('should allow appending all parameters of different types', () => { + const body = new HttpParams({fromString: 'a=true&b=b1'}); + const mutated = body.appendAll({a: [true, 0, 'a1'] as const, b: 'b2'}); + expect(mutated.toString()).toEqual('a=true&a=true&a=0&a=a1&b=b1&b=b2'); + }); + it('should allow deletion of parameters', () => { const body = new HttpParams({fromString: 'a=b&c=d&e=f'}); const mutated = body.delete('c'); expect(mutated.toString()).toEqual('a=b&e=f'); }); + it('should allow deletion of parameters with specific string value', () => { + const body = new HttpParams({fromString: 'a=b&c=d&e=f'}); + const notMutated = body.delete('c', 'z'); + expect(notMutated.toString()).toEqual('a=b&c=d&e=f'); + const mutated = body.delete('c', 'd'); + expect(mutated.toString()).toEqual('a=b&e=f'); + }); + + it('should allow deletion of parameters with specific number value', () => { + const body = new HttpParams({fromString: 'a=b&c=1&e=f'}); + const notMutated = body.delete('c', 2); + expect(notMutated.toString()).toEqual('a=b&c=1&e=f'); + const mutated = body.delete('c', 1); + expect(mutated.toString()).toEqual('a=b&e=f'); + }); + + it('should allow deletion of parameters with specific boolean value', () => { + const body = new HttpParams({fromString: 'a=b&c=true&e=f'}); + const notMutated = body.delete('c', false); + expect(notMutated.toString()).toEqual('a=b&c=true&e=f'); + const mutated = body.delete('c', true); + expect(mutated.toString()).toEqual('a=b&e=f'); + }); + it('should allow chaining of mutations', () => { const body = new HttpParams({fromString: 'a=b&c=d&e=f'}); const mutated = body.append('e', 'y').delete('c').set('a', 'x').append('e', 'z'); expect(mutated.toString()).toEqual('a=x&e=f&e=y&e=z'); }); - it('should allow deletion of one value of a parameter', () => { + it('should allow deletion of one value of a string parameter', () => { const body = new HttpParams({fromString: 'a=1&a=2&a=3&a=4&a=5'}); const mutated = body.delete('a', '2').delete('a', '4'); expect(mutated.getAll('a')).toEqual(['1', '3', '5']); }); + it('should allow deletion of one value of a number parameter', () => { + const body = new HttpParams({fromString: 'a=0&a=1&a=2&a=3&a=4&a=5'}); + const mutated = body.delete('a', 0).delete('a', 4); + expect(mutated.getAll('a')).toEqual(['1', '2', '3', '5']); + }); + + it('should allow deletion of one value of a boolean parameter', () => { + const body = new HttpParams({fromString: 'a=false&a=true&a=false'}); + const mutated = body.delete('a', false); + expect(mutated.getAll('a')).toEqual(['true', 'false']); + }); + it('should not repeat mutations that have already been materialized', () => { const body = new HttpParams({fromString: 'a=b'}); const mutated = body.append('a', 'c'); @@ -101,10 +179,30 @@ import {HttpParams} from '@angular/common/http/src/params'; const body = new HttpParams({fromObject: {a: '', b: '2', c: '3'}}); expect(body.toString()).toBe('a=&b=2&c=3'); }); - it('should stringify array params', () => { + it('should stringify string array params', () => { const body = new HttpParams({fromObject: {a: '', b: ['21', '22'], c: '3'}}); expect(body.toString()).toBe('a=&b=21&b=22&c=3'); }); + it('should stringify number params', () => { + const body = new HttpParams({fromObject: {a: '', b: 2, c: 3}}); + expect(body.toString()).toBe('a=&b=2&c=3'); + }); + it('should stringify number array params', () => { + const body = new HttpParams({fromObject: {a: '', b: [21, 22], c: 3}}); + expect(body.toString()).toBe('a=&b=21&b=22&c=3'); + }); + it('should stringify boolean params', () => { + const body = new HttpParams({fromObject: {a: '', b: true, c: 3}}); + expect(body.toString()).toBe('a=&b=true&c=3'); + }); + it('should stringify boolean array params', () => { + const body = new HttpParams({fromObject: {a: '', b: [true, false], c: 3}}); + expect(body.toString()).toBe('a=&b=true&b=false&c=3'); + }); + it('should stringify array params of different types', () => { + const body = new HttpParams({fromObject: {a: ['', false, 3] as const}}); + expect(body.toString()).toBe('a=&a=false&a=3'); + }); it('should stringify empty array params', () => { const body = new HttpParams({fromObject: {a: '', b: [], c: '3'}}); expect(body.toString()).toBe('a=&c=3');