diff --git a/src/utils.ts b/src/utils.ts index 2e9ac276e..4f53ed762 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -250,6 +250,10 @@ export function removeConnectionEventListeners(cb: (e: Event) => void) { export const axiosParamsSerializer: AxiosRequestConfig['paramsSerializer'] = (params) => { const newParams = []; for (const k in params) { + // Stream backend doesn't treat "undefined" value same as value not being present. + // So, we need to skip the undefined values. + if (params[k] === undefined) continue; + if (Array.isArray(params[k]) || typeof params[k] === 'object') { newParams.push(`${k}=${encodeURIComponent(JSON.stringify(params[k]))}`); } else { diff --git a/test/unit/utils.js b/test/unit/utils.js index 95b0647df..120cd1b01 100644 --- a/test/unit/utils.js +++ b/test/unit/utils.js @@ -77,6 +77,7 @@ describe('axiosParamsSerializer', () => { a: 1, b: 2, c: null, + d: undefined, }, output: 'a=1&b=2&c=null', },