Skip to content

Commit 1c5df96

Browse files
tasgonlucasfernog
andauthored
fix(protocol): proxy body in mobile dev (#13773)
* proxy body in mobile dev * add change file, use std::mem::take --------- Co-authored-by: Lucas Nogueira <[email protected]>
1 parent 4f96ed4 commit 1c5df96

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changes/proxy-body.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Forward request body on the mobile frontend proxy.

crates/tauri/src/protocol/tauri.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn get<R: Runtime>(
6969
}
7070

7171
fn get_response<R: Runtime>(
72-
request: Request<Vec<u8>>,
72+
#[allow(unused_mut)] mut request: Request<Vec<u8>>,
7373
#[allow(unused_variables)] manager: &AppManager<R>,
7474
window_origin: &str,
7575
web_resource_request_handler: Option<&WebResourceRequestHandler>,
@@ -118,9 +118,11 @@ fn get_response<R: Runtime>(
118118
.build()
119119
.unwrap()
120120
.request(request.method().clone(), &url);
121+
proxy_builder = proxy_builder.body(std::mem::take(request.body_mut()));
121122
for (name, value) in request.headers() {
122123
proxy_builder = proxy_builder.header(name, value);
123124
}
125+
proxy_builder = proxy_builder.body(request.body().clone());
124126
match crate::async_runtime::safe_block_on(proxy_builder.send()) {
125127
Ok(r) => {
126128
let mut response_cache_ = response_cache.lock().unwrap();

0 commit comments

Comments
 (0)