Skip to content

http: improve error message with null header #46048

Description

@mgechev

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions