From 21fed04c002f6b2f0f0f1feac021222e86a8d645 Mon Sep 17 00:00:00 2001 From: enri90 Date: Mon, 20 May 2024 05:16:03 +0200 Subject: [PATCH 1/6] feat(upload): Sync v2 repository --- plugins/upload/api-iife.js | 2 +- plugins/upload/guest-js/index.ts | 8 +++++--- plugins/upload/src/lib.rs | 10 +++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/upload/api-iife.js b/plugins/upload/api-iife.js index 188b262a2a..4bb1b9b47e 100644 --- a/plugins/upload/api-iife.js +++ b/plugins/upload/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function n(e,t,n,o,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;class i{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:i})=>{if(i===t(this,s,"f")){n(this,s,i+1),t(this,o,"f").call(this,e);const a=Object.keys(t(this,r,"f"));if(a.length>0){let e=i+1;for(const n of a.sort()){if(parseInt(n)!==e)break;{const s=t(this,r,"f")[n];delete t(this,r,"f")[n],t(this,o,"f").call(this,s),e+=1}}n(this,s,e)}}else t(this,r,"f")[i.toString()]=e}))}set onmessage(e){n(this,o,e)}get onmessage(){return t(this,o,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function a(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return o=new WeakMap,s=new WeakMap,r=new WeakMap,e.download=async function(e,t,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],c=new i;n&&(c.onmessage=n),await a("plugin:upload|download",{id:r,url:e,filePath:t,headers:o??{},onProgress:c})},e.upload=async function(e,t,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],c=new i;return n&&(c.onmessage=n),await a("plugin:upload|upload",{id:r,url:e,filePath:t,headers:o??{},onProgress:c})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function n(e,t,n,o,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;class i{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:i})=>{if(i===t(this,s,"f")){n(this,s,i+1),t(this,o,"f").call(this,e);const a=Object.keys(t(this,r,"f"));if(a.length>0){let e=i+1;for(const n of a.sort()){if(parseInt(n)!==e)break;{const s=t(this,r,"f")[n];delete t(this,r,"f")[n],t(this,o,"f").call(this,s),e+=1}}n(this,s,e)}}else t(this,r,"f")[i.toString()]=e}))}set onmessage(e){n(this,o,e)}get onmessage(){return t(this,o,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function a(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return o=new WeakMap,s=new WeakMap,r=new WeakMap,e.download=async function(e,t,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const c=r[0],_=new i;n&&(_.onmessage=n),await a("plugin:upload|download",{id:c,url:e,filePath:t,headers:o??{},onProgress:_,body:s??""})},e.upload=async function(e,t,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],c=new i;return n&&(c.onmessage=n),await a("plugin:upload|upload",{id:r,url:e,filePath:t,headers:o??{},onProgress:c})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 9586a241a3..62176f44c4 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -43,7 +43,8 @@ async function download( url: string, filePath: string, progressHandler?: ProgressHandler, - headers?: Map + headers?: Map, + body?: string, ): Promise { const ids = new Uint32Array(1) window.crypto.getRandomValues(ids) @@ -59,8 +60,9 @@ async function download( url, filePath, headers: headers ?? {}, - onProgress - }) + onProgress, + body: body ?? null, + }); } export { download, upload } diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index 9351b246bd..599f03df28 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -66,11 +66,15 @@ async fn download( file_path: &str, headers: HashMap, on_progress: Channel, + body: String, ) -> Result<()> { let client = reqwest::Client::new(); - - let mut request = client.get(url); - // Loop through the headers keys and values + let mut request = if !body.is_empty() { + client.post(url).body(body.to_owned()) + } else { + client.get(url) + }; + // Loop trought the headers keys and values // and add them to the request object. for (key, value) in headers { request = request.header(&key, value); From c3c8d099bad6664b0c3f584abba90464b08866ae Mon Sep 17 00:00:00 2001 From: enri90 Date: Mon, 20 May 2024 05:33:04 +0200 Subject: [PATCH 2/6] chore: Update Version --- plugins/upload/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/upload/package.json b/plugins/upload/package.json index 03b1c9eae7..64da4e18b7 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -25,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "^2.0.0" + "@tauri-apps/api": "^2.0.3" } } From 2403ef9f05097d23ed18c9edaccec651c600acaf Mon Sep 17 00:00:00 2001 From: enri90 Date: Wed, 22 May 2024 18:09:10 +0200 Subject: [PATCH 3/6] chore: update required --- .changes/feat-download-on-post.md | 5 +++++ plugins/upload/api-iife.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/feat-download-on-post.md diff --git a/.changes/feat-download-on-post.md b/.changes/feat-download-on-post.md new file mode 100644 index 0000000000..aebebb6303 --- /dev/null +++ b/.changes/feat-download-on-post.md @@ -0,0 +1,5 @@ +--- +upload: patch +--- + +Added post request on download function \ No newline at end of file diff --git a/plugins/upload/api-iife.js b/plugins/upload/api-iife.js index 4bb1b9b47e..32632a8eeb 100644 --- a/plugins/upload/api-iife.js +++ b/plugins/upload/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function n(e,t,n,o,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;class i{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:i})=>{if(i===t(this,s,"f")){n(this,s,i+1),t(this,o,"f").call(this,e);const a=Object.keys(t(this,r,"f"));if(a.length>0){let e=i+1;for(const n of a.sort()){if(parseInt(n)!==e)break;{const s=t(this,r,"f")[n];delete t(this,r,"f")[n],t(this,o,"f").call(this,s),e+=1}}n(this,s,e)}}else t(this,r,"f")[i.toString()]=e}))}set onmessage(e){n(this,o,e)}get onmessage(){return t(this,o,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function a(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return o=new WeakMap,s=new WeakMap,r=new WeakMap,e.download=async function(e,t,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const c=r[0],_=new i;n&&(_.onmessage=n),await a("plugin:upload|download",{id:c,url:e,filePath:t,headers:o??{},onProgress:_,body:s??""})},e.upload=async function(e,t,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],c=new i;return n&&(c.onmessage=n),await a("plugin:upload|upload",{id:r,url:e,filePath:t,headers:o??{},onProgress:c})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(e){"use strict";function t(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function n(e,t,n,o,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;class i{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}((({message:e,id:i})=>{if(i===t(this,s,"f")){n(this,s,i+1),t(this,o,"f").call(this,e);const a=Object.keys(t(this,r,"f"));if(a.length>0){let e=i+1;for(const n of a.sort()){if(parseInt(n)!==e)break;{const s=t(this,r,"f")[n];delete t(this,r,"f")[n],t(this,o,"f").call(this,s),e+=1}}n(this,s,e)}}else t(this,r,"f")[i.toString()]=e}))}set onmessage(e){n(this,o,e)}get onmessage(){return t(this,o,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function a(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}return o=new WeakMap,s=new WeakMap,r=new WeakMap,e.download=async function(e,t,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const c=r[0],_=new i;n&&(_.onmessage=n),await a("plugin:upload|download",{id:c,url:e,filePath:t,headers:o??{},onProgress:_,body:s??null})},e.upload=async function(e,t,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],c=new i;return n&&(c.onmessage=n),await a("plugin:upload|upload",{id:r,url:e,filePath:t,headers:o??{},onProgress:c})},e}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} From 0d3a3f42553e044b1ee224bcb076c01c0b9c211d Mon Sep 17 00:00:00 2001 From: FabianLars Date: Tue, 3 Dec 2024 13:37:50 +0100 Subject: [PATCH 4/6] fix optional value --- .changes/feat-download-on-post.md | 1 + plugins/upload/api-iife.js | 2 +- plugins/upload/guest-js/index.ts | 6 +++--- plugins/upload/package.json | 2 +- plugins/upload/src/lib.rs | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.changes/feat-download-on-post.md b/.changes/feat-download-on-post.md index aebebb6303..8f2fe206e9 100644 --- a/.changes/feat-download-on-post.md +++ b/.changes/feat-download-on-post.md @@ -1,5 +1,6 @@ --- upload: patch +upload-js: patch --- Added post request on download function \ No newline at end of file diff --git a/plugins/upload/api-iife.js b/plugins/upload/api-iife.js index ffd056d460..5918901f71 100644 --- a/plugins/upload/api-iife.js +++ b/plugins/upload/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(t){"use strict";function e(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}function n(t,e,n,o,s){if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;const i="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:i})=>{if(i===e(this,s,"f")){n(this,s,i+1),e(this,o,"f").call(this,t);const a=Object.keys(e(this,r,"f"));if(a.length>0){let t=i+1;for(const n of a.sort()){if(parseInt(n)!==t)break;{const s=e(this,r,"f")[n];delete e(this,r,"f")[n],e(this,o,"f").call(this,s),t+=1}}n(this,s,t)}}else e(this,r,"f")[i.toString()]=t}))}set onmessage(t){n(this,o,t)}get onmessage(){return e(this,o,"f")}[(o=new WeakMap,s=new WeakMap,r=new WeakMap,i)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[i]()}}async function _(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.download=async function(t,e,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const i=r[0],c=new a;n&&(c.onmessage=n),await _("plugin:upload|download",{id:i,url:t,filePath:e,headers:o??{},onProgress:c,body:s??null})},t.upload=async function(t,e,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],i=new a;return n&&(i.onmessage=n),await _("plugin:upload|upload",{id:r,url:t,filePath:e,headers:o??{},onProgress:i})},t}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_UPLOAD__=function(t){"use strict";function e(t,e,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(t):o?o.value:e.get(t)}function n(t,e,n,o,s){if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var o,s,r;"function"==typeof SuppressedError&&SuppressedError;const i="__TAURI_TO_IPC_KEY__";class a{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,o.set(this,(()=>{})),s.set(this,0),r.set(this,{}),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((({message:t,id:i})=>{if(i===e(this,s,"f")){n(this,s,i+1),e(this,o,"f").call(this,t);const a=Object.keys(e(this,r,"f"));if(a.length>0){let t=i+1;for(const n of a.sort()){if(parseInt(n)!==t)break;{const s=e(this,r,"f")[n];delete e(this,r,"f")[n],e(this,o,"f").call(this,s),t+=1}}n(this,s,t)}}else e(this,r,"f")[i.toString()]=t}))}set onmessage(t){n(this,o,t)}get onmessage(){return e(this,o,"f")}[(o=new WeakMap,s=new WeakMap,r=new WeakMap,i)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[i]()}}async function _(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}return t.download=async function(t,e,n,o,s){const r=new Uint32Array(1);window.crypto.getRandomValues(r);const i=r[0],c=new a;n&&(c.onmessage=n),await _("plugin:upload|download",{id:i,url:t,filePath:e,headers:o??{},onProgress:c,body:s})},t.upload=async function(t,e,n,o){const s=new Uint32Array(1);window.crypto.getRandomValues(s);const r=s[0],i=new a;return n&&(i.onmessage=n),await _("plugin:upload|upload",{id:r,url:t,filePath:e,headers:o??{},onProgress:i})},t}({});Object.defineProperty(window.__TAURI__,"upload",{value:__TAURI_PLUGIN_UPLOAD__})} diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 2e98351e27..0ffeaf2a99 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -46,7 +46,7 @@ async function download( filePath: string, progressHandler?: ProgressHandler, headers?: Map, - body?: string, + body?: string ): Promise { const ids = new Uint32Array(1) window.crypto.getRandomValues(ids) @@ -63,8 +63,8 @@ async function download( filePath, headers: headers ?? {}, onProgress, - body: body ?? null, - }); + body: body + }) } export { download, upload } diff --git a/plugins/upload/package.json b/plugins/upload/package.json index 29d9fa7777..b7f6b58570 100644 --- a/plugins/upload/package.json +++ b/plugins/upload/package.json @@ -25,6 +25,6 @@ "LICENSE" ], "dependencies": { - "@tauri-apps/api": "^2.0.3" + "@tauri-apps/api": "^2.0.0" } } diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index cf2d88c67b..7945ed8e97 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -70,11 +70,11 @@ async fn download( file_path: &str, headers: HashMap, on_progress: Channel, - body: String, + body: Option, ) -> 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) }; From 3c1a7314d0f5b42ec28cec4578e6cce37ab336ab Mon Sep 17 00:00:00 2001 From: FabianLars Date: Tue, 3 Dec 2024 13:38:46 +0100 Subject: [PATCH 5/6] fmt --- plugins/upload/guest-js/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/upload/guest-js/index.ts b/plugins/upload/guest-js/index.ts index 0ffeaf2a99..03129db4b1 100644 --- a/plugins/upload/guest-js/index.ts +++ b/plugins/upload/guest-js/index.ts @@ -63,7 +63,7 @@ async function download( filePath, headers: headers ?? {}, onProgress, - body: body + body }) } From d98edb97743a6e003c5a7685b15f1d3e508a629e Mon Sep 17 00:00:00 2001 From: FabianLars Date: Tue, 3 Dec 2024 13:50:19 +0100 Subject: [PATCH 6/6] fix compilation --- plugins/fs/src/file_path.rs | 4 ++-- plugins/os/src/lib.rs | 2 +- plugins/shell/src/scope.rs | 2 +- plugins/stronghold/src/lib.rs | 2 +- plugins/upload/src/lib.rs | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/fs/src/file_path.rs b/plugins/fs/src/file_path.rs index 9ff7a9476d..735fc105ed 100644 --- a/plugins/fs/src/file_path.rs +++ b/plugins/fs/src/file_path.rs @@ -138,7 +138,7 @@ impl<'de> serde::Deserialize<'de> for FilePath { { struct FilePathVisitor; - impl<'de> serde::de::Visitor<'de> for FilePathVisitor { + impl serde::de::Visitor<'_> for FilePathVisitor { type Value = FilePath; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { @@ -169,7 +169,7 @@ impl<'de> serde::Deserialize<'de> for SafeFilePath { { struct SafeFilePathVisitor; - impl<'de> serde::de::Visitor<'de> for SafeFilePathVisitor { + impl serde::de::Visitor<'_> for SafeFilePathVisitor { type Value = SafeFilePath; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/plugins/os/src/lib.rs b/plugins/os/src/lib.rs index 913d174207..c041c8ea36 100644 --- a/plugins/os/src/lib.rs +++ b/plugins/os/src/lib.rs @@ -110,7 +110,7 @@ struct InitJavascript<'a> { exe_extension: &'a str, } -impl<'a> InitJavascript<'a> { +impl InitJavascript<'_> { fn new() -> Self { Self { #[cfg(windows)] diff --git a/plugins/shell/src/scope.rs b/plugins/shell/src/scope.rs index 9e76931aa8..d46bfa2028 100644 --- a/plugins/shell/src/scope.rs +++ b/plugins/shell/src/scope.rs @@ -224,7 +224,7 @@ impl OpenScope { } } -impl<'a> ShellScope<'a> { +impl ShellScope<'_> { /// Validates argument inputs and creates a Tauri sidecar [`Command`]. pub fn prepare_sidecar( &self, diff --git a/plugins/stronghold/src/lib.rs b/plugins/stronghold/src/lib.rs index 3454a662a3..23acc3a249 100644 --- a/plugins/stronghold/src/lib.rs +++ b/plugins/stronghold/src/lib.rs @@ -125,7 +125,7 @@ impl<'de> Deserialize<'de> for KeyType { { struct KeyTypeVisitor; - impl<'de> Visitor<'de> for KeyTypeVisitor { + impl Visitor<'_> for KeyTypeVisitor { type Value = KeyType; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/plugins/upload/src/lib.rs b/plugins/upload/src/lib.rs index 7945ed8e97..23c33b115d 100644 --- a/plugins/upload/src/lib.rs +++ b/plugins/upload/src/lib.rs @@ -69,11 +69,11 @@ async fn download( url: &str, file_path: &str, headers: HashMap, - on_progress: Channel, body: Option, + on_progress: Channel, ) -> Result<()> { let client = reqwest::Client::new(); - if let Some(body) = body { + let mut request = if let Some(body) = body { client.post(url).body(body) } else { client.get(url) @@ -210,7 +210,7 @@ mod tests { let _ = msg; Ok(()) }); - download(url, file_path, headers, sender).await + download(url, file_path, headers, None, sender).await } async fn spawn_server_mocked(return_status: usize) -> MockedServer {