Skip to content

Commit

Permalink
fix: axios param serializer to comply with RFC 3986
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Oct 3, 2023
1 parent 88ef7ef commit 1c901dc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
this.defaultWSTimeoutWithFallback = 6000;
this.defaultWSTimeout = 15000;

this.axiosInstance.defaults.paramsSerializer = (params) => {
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
Expand Down

0 comments on commit 1c901dc

Please sign in to comment.