refactor(upload)!: take headers, method and body via an options object (#3613)

`upload(url, path, onProgress, { headers, method })` and
`download(url, path, onProgress, { headers, body })` replace the
positional optional arguments.

`headers` accepts both a `Map` and a plain object; previously a `Map`
was silently serialized as an empty object.
This commit is contained in:
Lucas Fernandes Nogueira
2026-09-22 06:07:43 -03:00
committed by GitHub
parent b2d7c387ef
commit 0ecb30e3cb
5 changed files with 94 additions and 25 deletions
+12
View File
@@ -0,0 +1,12 @@
---
"upload-js": major
---
**Breaking:** `upload` and `download` now take an `options` object as their last argument instead of positional `headers`, `method` and `body` arguments:
```ts
await upload(url, filePath, onProgress, { headers, method: HttpMethod.Put })
await download(url, filePath, onProgress, { headers, body })
```
`headers` accepts both a `Map` and a plain object. Previously a `Map` was silently serialized as an empty object.