Skip to content

Commit

Permalink
fix: use .append instead of .set for FormData (oven-sh/bun#12325)
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Jul 3, 2024
1 parent ebff02f commit ebe59dc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
Binary file modified bun.lockb
Binary file not shown.
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"name": "@gramio/files",
"main": "./dist/index.js",
"version": "0.0.9",
"type": "commonjs",
"description": "Set of utils for work with files and Telegram Bot API",
"keywords": [
"gramio",
"telegram",
"file",
"files",
"upload"
],
"scripts": {
"generate": "bun scripts/generate.ts",
"prepublishOnly": "tsc",
"lint": "bunx @biomejs/biome check ./src",
"lint:fix": "bun lint --apply",
"jsr": "bun scripts/release-jsr.ts"
},
"devDependencies": {
"@biomejs/biome": "1.7.3",
"@types/bun": "^1.1.6",
"@types/node": "^20.14.9",
"prettier": "^3.3.2",
"typescript": "^5.5.2"
},
"dependencies": {
"@gramio/types": "^7.6.0"
},
"files": [
"dist"
]
"name": "@gramio/files",
"main": "./dist/index.js",
"version": "0.0.10",
"type": "commonjs",
"description": "Set of utils for work with files and Telegram Bot API",
"keywords": [
"gramio",
"telegram",
"file",
"files",
"upload"
],
"scripts": {
"generate": "bun scripts/generate.ts",
"prepublishOnly": "tsc",
"lint": "bunx @biomejs/biome check ./src",
"lint:fix": "bun lint --apply",
"jsr": "bun scripts/release-jsr.ts"
},
"devDependencies": {
"@biomejs/biome": "1.7.3",
"@types/bun": "^1.1.6",
"@types/node": "^20.14.9",
"prettier": "^3.3.2",
"typescript": "^5.5.3"
},
"dependencies": {
"@gramio/types": "^7.6.0"
},
"files": [
"dist"
]
}
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ export async function convertJsonToFormData<T extends keyof APIMethods>(
for (let [key, value] of Object.entries(params)) {
if (value instanceof Promise) value = await value;

if (value instanceof Blob) formData.set(key, value);
if (value instanceof Blob) formData.append(key, value);
else if (typeof value === "object")
formData.set(key, JSON.stringify(value));
else formData.set(key, String(value));
formData.append(key, JSON.stringify(value));
else formData.append(key, String(value));
}

return formData;
Expand Down

0 comments on commit ebe59dc

Please sign in to comment.