Skip to content

Clarification on paramsSerializer option #4883

Discussion options

You must be logged in to vote

Is this correct?

Yes, this is correct for Axios v1.0.0-alpha.1

  axios.post("https://httpbin.org/post", data, {
    params: {
      foo: "bar",
      arr: [1, 2, 3]
    },
    paramsSerializer: {
      indexes: null
    }
  });

Resolved query string:

post?foo=bar&arr=1&arr=2&arr=3

Playground

Summary:

indexes: null -> post?foo=bar&arr=1&arr=2&arr=3
indexes: false (default) -> post?foo=bar&arr[]=1&arr[]=2&arr[]=3
indexes: true -> post?foo=bar&arr[0]=1&arr[1]=2&arr[2]=3

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zachlearnscode
Comment options

Answer selected by jasonsaayman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants