mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user