inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.3k stars 423 forks source link

`encode: false` doesn't work in custom axios param serialiser #1932

Open mrleblanc101 opened 2 months ago

mrleblanc101 commented 2 months ago

Version:

Describe the problem:

I followed the exemple in #282. My query ?sort=client.name%2Casc should be ?sort=client.name,asc. This works in vue-router/nuxt using the same qs package params.

Steps to reproduce:

axios.interceptors.request.use(
    function (config) {
        let url = new URL(config.url);
        url.search = qs.stringify(qs.parse(url.search, { ignoreQueryPrefix: true }), {
            encode: false,
            skipNulls: true,
            arrayFormat: 'comma',
            commaRoundTrip: true,
        });
        config.url = url.href;
        return config;
    },
    function (error) {
        return Promise.reject(error);
    },
);