diff --git a/src/actions/media.ts b/src/actions/media.ts index b42d8e5c6..5cbac7381 100644 --- a/src/actions/media.ts +++ b/src/actions/media.ts @@ -37,7 +37,7 @@ const uploadMediaV1 = (body: FormData, onUploadProgress = noOp) => api(getState)('/api/v1/media', { method: 'POST', body, - headers: { 'Content-Type': 'multipart/form-data' }, + headers: { 'Content-Type': '' }, // }, { // onUploadProgress: onUploadProgress, }); @@ -47,7 +47,7 @@ const uploadMediaV2 = (body: FormData, onUploadProgress = noOp) => api(getState)('/api/v2/media', { method: 'POST', body, - headers: { 'Content-Type': 'multipart/form-data' }, + headers: { 'Content-Type': '' }, // }, { // onUploadProgress: onUploadProgress, }); diff --git a/src/api/hooks/groups/useCreateGroup.ts b/src/api/hooks/groups/useCreateGroup.ts index afc1ea092..a504e3b2c 100644 --- a/src/api/hooks/groups/useCreateGroup.ts +++ b/src/api/hooks/groups/useCreateGroup.ts @@ -23,9 +23,7 @@ function useCreateGroup() { return api('/api/v1/groups', { method: 'POST', - headers: { - 'Content-Type': 'multipart/form-data', - }, + headers: { 'Content-Type': '' }, body: formData, }); }, { schema: groupSchema }); diff --git a/src/api/hooks/groups/useUpdateGroup.ts b/src/api/hooks/groups/useUpdateGroup.ts index 576e31e41..7e0f848ad 100644 --- a/src/api/hooks/groups/useUpdateGroup.ts +++ b/src/api/hooks/groups/useUpdateGroup.ts @@ -22,9 +22,7 @@ function useUpdateGroup(groupId: string) { return api(`/api/v1/groups/${groupId}`, { method: 'PUT', - headers: { - 'Content-Type': 'multipart/form-data', - }, + headers: { 'Content-Type': '' }, body: formData, }); }, { schema: groupSchema }); diff --git a/src/api/index.ts b/src/api/index.ts index f3db535d0..036713e05 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -45,13 +45,16 @@ export const getFetch = (accessToken?: string | null, baseURL: string = '') => const fullPath = buildFullPath(input.toString(), isURL(BuildConfig.BACKEND_URL) ? BuildConfig.BACKEND_URL : baseURL, init?.params); const headers = new Headers(init?.headers); - const contentType = headers.get('Content-Type') || 'application/json'; if (accessToken) { headers.set('Authorization', `Bearer ${accessToken}`); } - headers.set('Content-Type', contentType); + if (headers.get('Content-Type') === '') { + headers.delete('Content-Type'); + } else { + headers.set('Content-Type', headers.get('Content-Type') || 'application/json'); + } return fetch(fullPath, { ...init,