@@ -359,30 +359,6 @@ pub fn fetch_cancel<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> crate::
359
359
Ok ( ( ) )
360
360
}
361
361
362
- #[ command]
363
- pub async fn fetch_read_body < R : Runtime > (
364
- webview : Webview < R > ,
365
- rid : ResourceId ,
366
- stream_channel : Channel < tauri:: ipc:: InvokeResponseBody > ,
367
- ) -> crate :: Result < ( ) > {
368
- let res = {
369
- let mut resources_table = webview. resources_table ( ) ;
370
- resources_table. take :: < ReqwestResponse > ( rid) ?
371
- } ;
372
-
373
- let mut res = Arc :: into_inner ( res) . unwrap ( ) . 0 ;
374
-
375
- // send response through IPC channel
376
- while let Some ( chunk) = res. chunk ( ) . await ? {
377
- stream_channel. send ( tauri:: ipc:: InvokeResponseBody :: Raw ( chunk. to_vec ( ) ) ) ?;
378
- }
379
-
380
- // send empty vector when done
381
- stream_channel. send ( tauri:: ipc:: InvokeResponseBody :: Raw ( Vec :: new ( ) ) ) ?;
382
-
383
- Ok ( ( ) )
384
- }
385
-
386
362
#[ command]
387
363
pub async fn fetch_send < R : Runtime > (
388
364
webview : Webview < R > ,
@@ -435,6 +411,30 @@ pub async fn fetch_send<R: Runtime>(
435
411
} )
436
412
}
437
413
414
+ #[ command]
415
+ pub async fn fetch_read_body < R : Runtime > (
416
+ webview : Webview < R > ,
417
+ rid : ResourceId ,
418
+ stream_channel : Channel < tauri:: ipc:: InvokeResponseBody > ,
419
+ ) -> crate :: Result < ( ) > {
420
+ let res = {
421
+ let mut resources_table = webview. resources_table ( ) ;
422
+ resources_table. take :: < ReqwestResponse > ( rid) ?
423
+ } ;
424
+
425
+ let mut res = Arc :: into_inner ( res) . unwrap ( ) . 0 ;
426
+
427
+ // send response through IPC channel
428
+ while let Some ( chunk) = res. chunk ( ) . await ? {
429
+ stream_channel. send ( tauri:: ipc:: InvokeResponseBody :: Raw ( chunk. to_vec ( ) ) ) ?;
430
+ }
431
+
432
+ // send empty vector when done
433
+ stream_channel. send ( tauri:: ipc:: InvokeResponseBody :: Raw ( Vec :: new ( ) ) ) ?;
434
+
435
+ Ok ( ( ) )
436
+ }
437
+
438
438
// forbidden headers per fetch spec https://fetch.spec.whatwg.org/#terminology-headers
439
439
#[ cfg( not( feature = "unsafe-headers" ) ) ]
440
440
fn is_unsafe_header ( header : & HeaderName ) -> bool {
0 commit comments