Skip to content

getUri ignores paramsSerializer if it is a callback #6676

@rjwats

Description

@rjwats

Describe the bug

When using axios's getUri function with a callback provided to paramsSerializer configuration option, the callback is not respected.

There is a minimal reproducible code snippet attached to this bug report.

See full example on codesandbox:

https://codesandbox.io/p/sandbox/l4q5g3

To Reproduce

Create an axios instance and attempt to call getUri with a CustomParamsSerializer callback provided to paramsSerializer.

Code snippet

const AXIOS = new Axios({});

return AXIOS.getUri({
  url: "https://www.example.com/api",
  params: {hello: "world"},
  paramsSerializer: () => "foo=bar"
});

Expected behavior

URI should be:

https://www.example.com/api?foo=bar

URI is instead:

https://www.example.com/api?hello=world

Axios Version

1.7.7

Adapter Version

No response

Browser

Chrome

Browser Version

130

Node.js Version

No response

OS

No response

Additional Library Versions

React 18

Additional context/Screenshots

No response

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