Skip to content

url.indexOf is not a function #6546

@ray73864

Description

@ray73864

Describe the bug

Trying to send a simple get request using Axios by doing:

const url = new URL(document.location.href);

try {
  const response = await axios.get(url, { params: { test: "Hi" } });
} catch (err) {
  console.log(err);
}

Error on the console about url.indexOf is not a function.

As soon as I change it to url.toString(), Axios performs the request.

It's getting stuck at var hashmarkIndex = url.indexOf("#"); (Line 1753 of dist/axios.js).

To Reproduce

No response

Code snippet

No response

Expected behavior

No response

Axios Version

No response

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

Metadata

Metadata

Assignees

Labels

issue::bugThis issue is related to a bug that requires fixing

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions