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

  1. added
    featureLabel used to distinguish feature request from other issues
    area: common/httpIssues related to HTTP and HTTP Client
    on May 18, 2022
  2. added this to the Backlog milestone on May 18, 2022
  3. markostanimirovic commented on May 19, 2022

    @markostanimirovic
    Contributor

    I can raise the PR for this issue if you agree 🙂

  4. changed the title [-]Improve error message with null header[/-] [+]http: improve error message with null header[/+] on May 19, 2022
  5. varthc commented on May 25, 2022

    @varthc

    Oh please, a big yes to this! This was a bug I came across like 6 months ago and it was a really pain in the neck to debug (value was null for some users not all).

  6. added a commit that references this issue on Jun 15, 2022
    c646140
  7. angular-automatic-lock-bot commented on Jul 17, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Jul 17, 2022
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