Skip to content

Commit

Permalink
fix: use postForm instead of post for sending files (#1199)
Browse files Browse the repository at this point in the history
  • Loading branch information
santhoshvai committed Nov 22, 2023
1 parent a4280fd commit 2b06ca4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,9 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
case 'post':
response = await this.axiosInstance.post(url, data, requestConfig);
break;
case 'postForm':
response = await this.axiosInstance.postForm(url, data, requestConfig);
break;
case 'put':
response = await this.axiosInstance.put(url, data, requestConfig);
break;
Expand Down Expand Up @@ -1034,7 +1037,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
const data = addFileToFormData(uri, name, contentType);
if (user != null) data.append('user', JSON.stringify(user));

return this.doAxiosRequest<SendFileAPIResponse>('post', url, data, {
return this.doAxiosRequest<SendFileAPIResponse>('postForm', url, data, {
headers: data.getHeaders ? data.getHeaders() : {}, // node vs browser
config: {
timeout: 0,
Expand Down

0 comments on commit 2b06ca4

Please sign in to comment.