🐞 bug report
Affected Package
The issue is caused by package @angular/common/http
Is this a regression?
Yes, the previous version in which this bug was not present was: Angular v9
Description
Our interceptor - which worked before - at Angular version 10 started to cause some issues. The source of the issues is the setHeaders property of the update object in the clone() function. According to the http.d.ts file it expects [name: string]: string | string[];, but if I pass in a single string, I will get the following error: TypeError: Invalid attempt to spread non-iterable instance, which is coming from the http module.
If I wrap that string into [], everything starts to work.
🔥 Exception or Error
TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
at _nonIterableSpread (nonIterableSpread.js:2)
at _toConsumableArray (toConsumableArray.js:6)
at HttpHeaders.applyUpdate (headers.ts:227)
at headers.ts:191
at Array.forEach ()
at HttpHeaders.init (headers.ts:191)
at HttpHeaders.forEach (headers.ts:256)
at Observable._subscribe (xhr.ts:98)
at Observable._trySubscribe (Observable.ts:238)
at Observable.subscribe (Observable.ts:219)
🌍 Your Environment
Angular Version:
@angular-devkit/architect 0.1001.6
@angular-devkit/build-angular 0.1001.6
@angular-devkit/build-optimizer 0.803.29
@angular-devkit/core 10.1.6
@angular-devkit/schematics 10.1.6
@angular/cdk 10.2.4
@angular/cli 10.1.6
@angular/material 10.2.4
@schematics/angular 10.1.6
@schematics/update 0.1001.6
rxjs 6.6.3
typescript 4.0.3
🐞 bug report
Affected Package
The issue is caused by package @angular/common/http
Is this a regression?
Yes, the previous version in which this bug was not present was: Angular v9
Description
Our interceptor - which worked before - at Angular version 10 started to cause some issues. The source of the issues is the
setHeadersproperty of the update object in theclone()function. According to thehttp.d.tsfile it expects[name: string]: string | string[];, but if I pass in a single string, I will get the following error:TypeError: Invalid attempt to spread non-iterable instance, which is coming from the http module.If I wrap that string into
[], everything starts to work.🔥 Exception or Error
🌍 Your Environment
Angular Version: