Skip to content

Commit

Permalink
fix: 🐛 Fix FormData query body getting parsed as json
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTomB committed Jan 24, 2023
1 parent 6723c82 commit ef05e84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-cows-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ethlete/query': patch
---

Fix FormData query body getting parsed as json
8 changes: 4 additions & 4 deletions libs/query/src/lib/request/request.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@ export const buildBody = (body: unknown) => {
return body;
}

if (typeof body === 'object') {
return JSON.stringify(body);
}

if (body instanceof FormData) {
return body;
}

if (typeof body === 'object') {
return JSON.stringify(body);
}

throw invalidBodyError(body);
};

Expand Down

0 comments on commit ef05e84

Please sign in to comment.