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: add default contentType as multipart/form-data in sendFile #1202

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
contentType?: string,
user?: UserResponse<StreamChatGenerics>,
) {
const data = addFileToFormData(uri, name, contentType);
const data = addFileToFormData(uri, name, contentType || 'multipart/form-data');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have this default value within react and RN SDK. But adding the same to js client, for the cases where customer uses sendFile endpoint directly.

if (user != null) data.append('user', JSON.stringify(user));

return this.doAxiosRequest<SendFileAPIResponse>('postForm', url, data, {
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,10 @@ export type ChannelMemberResponse<StreamChatGenerics extends ExtendableGenerics
invite_rejected_at?: string;
invited?: boolean;
is_moderator?: boolean;
notifications_muted?: boolean;
role?: string;
shadow_banned?: boolean;
status?: string;
updated_at?: string;
user?: UserResponse<StreamChatGenerics>;
user_id?: string;
Expand Down Expand Up @@ -1745,8 +1747,10 @@ export type ChannelMembership<StreamChatGenerics extends ExtendableGenerics = De
channel_role?: Role;
created_at?: string;
is_moderator?: boolean;
notifications_muted?: boolean;
role?: string;
shadow_banned?: boolean;
status?: string;
updated_at?: string;
user?: UserResponse<StreamChatGenerics>;
};
Expand Down Expand Up @@ -2043,6 +2047,8 @@ type GiphyVersionInfo = {
height: string;
url: string;
width: string;
frames?: string;
size?: string;
};

type GiphyVersions =
Expand Down
Loading