From 1c901dc080a34c3a4a31520463efe4cb6c5fb41b Mon Sep 17 00:00:00 2001 From: Vishal Narkhede Date: Tue, 3 Oct 2023 11:52:42 +0200 Subject: [PATCH] fix: axios param serializer to comply with RFC 3986 --- src/client.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/client.ts b/src/client.ts index ba8e203707..2e7d4f29ad 100644 --- a/src/client.ts +++ b/src/client.ts @@ -305,6 +305,18 @@ export class StreamChat { + const newParams = []; + for (const k in params) { + if (Array.isArray(params[k]) || typeof params[k] === 'object') { + newParams.push(`${k}=${JSON.stringify(params[k])}`); + } else { + newParams.push(`${k}=${encodeURIComponent(params[k])}`); + } + } + return newParams.join('&'); + }; + /** * logger function should accept 3 parameters: * @param logLevel string