Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use postForm instead of post for sending files #1199

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading