Skip to content

Commit aec17a9

Browse files
authored
feat(http): improve performance (#558)
1 parent 12adc1d commit aec17a9

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

.changes/http-response.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"http": patch
3+
---
4+
5+
Improve response performance by using the new IPC streaming data.

plugins/http/src/commands.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,15 @@ pub async fn fetch_send<R: Runtime>(
163163
})
164164
}
165165

166-
// TODO: change return value to tauri::ipc::Response on next alpha
167166
#[command]
168167
pub(crate) async fn fetch_read_body<R: Runtime>(
169168
app: AppHandle<R>,
170169
rid: RequestId,
171-
) -> crate::Result<Vec<u8>> {
170+
) -> crate::Result<tauri::ipc::Response> {
172171
let mut response_table = app.http().responses.lock().await;
173172
let res = response_table
174173
.remove(&rid)
175174
.ok_or(Error::InvalidRequestId(rid))?;
176175

177-
Ok(res.bytes().await?.to_vec())
176+
Ok(tauri::ipc::Response::new(res.bytes().await?.to_vec()))
178177
}

0 commit comments

Comments
 (0)