Skip to content

Axios automatically decodes slashes in my path parameters #6712

Open
@gerhardadler

Description

Describe the bug

When using an URIencoded string in my url, Axios automatically decodes the slashes.

To Reproduce

See code snippet

Code snippet

const deviceId = 'very/cool/device/å';
const encodedDeviceId = encodeURIComponent(deviceId); // very%2Fcool%2Fdevice%2F%C3%A5

// the request goes to "http://localhost/search/very/cool/device/%C3%A5", giving me a 404 error
axios.get('http://localhost/search/' + encodedDeviceId)
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Expected behavior

I would expect Axios to not decode the slashes in my URL, and the request going to http://localhost/search/very%2Fcool%2Fdevice%2F%C3%A5

Axios Version

v0.29.0

Adapter Version

XHR/HTTP

Browser

Firefox, Chromium

Browser Version

132, 131

Node.js Version

v22.10.0

OS

Windows 10, openSUSE Tumbleweed

Additional Library Versions

No response

Additional context/Screenshots

No response

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