Skip to content

The irrelevant error returned when requesting illegal URL #3509

@markb-trustifi

Description

@markb-trustifi

Describe the bug

The irrelevant error returned when requesting illegal URL, like: "tel:484-695-3408"

TypeError: Cannot read property 'replace' of null
    at dispatchHttpRequest (node_modules/axios/lib/adapters/http.js:109:74)
    at new Promise (<anonymous>)
    at httpAdapter (node_modules/axios/lib/adapters/http.js:46:10)
    at dispatchRequest (node_modules/axios/lib/core/dispatchRequest.js:52:10)

To Reproduce

axios.get('tel:484-695-3408').catch(err => console.error(err));

Expected behavior

Return descriptive error, like "Unsupported protocol tel:"

Environment

  • Axios Version: 0.21.1
  • Adapter: HTTP
  • Browser: none
  • Browser Version: none
  • Node.js Version: 12.19.0
  • OS: MacOS 10.14
  • Additional Library Versions: none

Additional context/Screenshots

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions