diff --git a/.changes/upload-headers-record.md b/.changes/upload-headers-record.md new file mode 100644 index 000000000..71bb50849 --- /dev/null +++ b/.changes/upload-headers-record.md @@ -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`. diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 2783cbe91..02d45ab17 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -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, + // TODO: V3 - Combine headers and methods into one `options` object, switch to HeadersInit + headers?: Record | Map, method?: HttpMethod ): Promise { const ids = new Uint32Array(1) @@ -142,7 +142,7 @@ async function download( url: string, filePath: string, progressHandler?: ProgressHandler, - headers?: Map, + headers?: Record | Map, body?: string ): Promise { const ids = new Uint32Array(1)