Skip to content

Commit

Permalink
fix optional value
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars committed Dec 3, 2024
1 parent bf6d977 commit 0d3a3f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .changes/feat-download-on-post.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
upload: patch
upload-js: patch
---

Added post request on download function
2 changes: 1 addition & 1 deletion plugins/upload/api-iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions plugins/upload/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function download(
filePath: string,
progressHandler?: ProgressHandler,
headers?: Map<string, string>,
body?: string,
body?: string
): Promise<void> {
const ids = new Uint32Array(1)
window.crypto.getRandomValues(ids)
Expand All @@ -63,8 +63,8 @@ async function download(
filePath,
headers: headers ?? {},
onProgress,
body: body ?? null,
});
body: body
})
}

export { download, upload }
2 changes: 1 addition & 1 deletion plugins/upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"LICENSE"
],
"dependencies": {
"@tauri-apps/api": "^2.0.3"
"@tauri-apps/api": "^2.0.0"
}
}
6 changes: 3 additions & 3 deletions plugins/upload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ async fn download(
file_path: &str,
headers: HashMap<String, String>,
on_progress: Channel<ProgressPayload>,
body: String,
body: Option<String>,
) -> Result<()> {
let client = reqwest::Client::new();
let mut request = if !body.is_empty() {
client.post(url).body(body.to_owned())
if let Some(body) = body {
client.post(url).body(body)
} else {
client.get(url)
};
Expand Down

0 comments on commit 0d3a3f4

Please sign in to comment.