developit/redaxios

Sending an array in a GET request turns it into a string

ragaeeb opened this issue · 1 comments

If you send an array as a parameter in a GET request, redaxios turns that into a string separated by commas. This seems like a bug.

On the server-side (ie: PHP) we would expect that to be provided as an array, but it ends up being a string.

In axios this is correctly kept as an array.

Got the same behaviour in my local laptop:

redaxios.get("some-url", {
  params: {
    names: ["name-1", "name-2"],
  },
});

On the backend, we got:

// redaxios
{ names: 'name-1,name-2' }

// axios
{ names: ["name-1", "name-2"] }

Is this sth expected?
Happy to work on it if this is confirmed to be a bug!