fix(upload): accept a plain object for headers (#3797)

* fix(upload): accept a plain object for headers

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>

* Update .changes/upload-headers-record.md

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>

* Apply suggestion from @lucasfernog

---------

Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-11-27 06:34:42 -03:00
1 parent f88842ea29
commit 53c4801744
2 files changed
+9 -3

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
upload: patch
upload-js: patch
---
Accept a plain object for the `headers` argument of `upload` and `download`, as shown in their examples, in addition to a `Map`.
+3 -3
View File
@@ -89,8 +89,8 @@ async function upload(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
// TODO: V3 - Combine headers and methods into one `options` object
headers?: Map<string, string>,
// TODO: V3 - Combine headers and methods into one `options` object, switch to HeadersInit
headers?: Record<string, string> | Map<string, string>,
method?: HttpMethod
): Promise<string> {
const ids = new Uint32Array(1)
@@ -142,7 +142,7 @@ async function download(
url: string,
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>,
headers?: Record<string, string> | Map<string, string>,
body?: string
): Promise<void> {
const ids = new Uint32Array(1)