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
+5 -7
View File
@@ -162,9 +162,7 @@
percentage: progress.total > 0 ? Math.round((progress.progressTotal / progress.total) * 100) : 0
}
},
new Map([
['User-Agent', 'Tauri Upload Plugin Demo']
])
{ headers: { 'User-Agent': 'Tauri Upload Plugin Demo' } }
)
downloadResult = {
@@ -211,10 +209,10 @@
percentage: progress.total > 0 ? Math.round((progress.progressTotal / progress.total) * 100) : 0
}
},
new Map([
['User-Agent', 'Tauri Upload Plugin Demo']
]),
uploadMethod
{
headers: { 'User-Agent': 'Tauri Upload Plugin Demo' },
method: uploadMethod
}
)
uploadResult = {