http: improve error message with null header
Which @angular/* package(s) are relevant/related to the feature request?
No response
Description
When a header value of an HTTP call is null we throw a TypeError: Cannot read properties of null (reading 'length').
That's accurate and could be more useful if we also specify the header with null value.
You can find a reproduction on StackBlitz.
Based on a discussion on Twitter here.
Proposed solution
Throw an error Cannot read the "length" property of the header "bar" because it has value null
Alternatives considered
Stricter typings of the headers so that we can show a type error.