Skip to content

Commit

Permalink
Merge branch 'main' into ajiang/fix-playground
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Jan 30, 2025
2 parents 3d707b2 + 5f0680c commit 0beb7b0
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ export async function toBodyInit(
for (const [key, value] of Object.entries(body.value)) {
switch (value.type) {
case "json": {
if (value.value !== undefined) {
if (value.value === undefined) {
break;
}
if (value.contentType === "application/json") {
formData.append(
key,
value.contentType
? new Blob([JSON.stringify(value.value)], {
type: value.contentType,
})
: JSON.stringify(value.value)
new Blob([JSON.stringify(value.value)], {
type: "application/json",
})
);
} else {
const finalValue =
typeof value.value === "string"
? value.value
: JSON.stringify(value.value);

formData.append(key, finalValue);
}
break;
}
Expand Down

0 comments on commit 0beb7b0

Please sign in to comment.