Skip to content

Commit

Permalink
fix: incorrect content type being set
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmellis committed Jul 22, 2024
1 parent 1d19bed commit 60befc6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/query/src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,12 @@ const query = async <T>(args: Args): Promise<T> => {

const body = getBody({ method, sourceData, stringify });

if (method !== 'GET' && typeof sourceData === 'object') {
headers['Content-Type'] = 'application/json';
if (!headers['Content-Type'] && method !== 'GET') {
if (sourceData instanceof FormData) {
headers['Content-Type'] = 'multipart/form-data';
} else if (sourceData && typeof sourceData === 'object') {
headers['Content-Type'] = 'application/json';
}
}

const response = await fetch(uri.toString(), {
Expand Down

0 comments on commit 60befc6

Please sign in to comment.