@@ -211,9 +211,6 @@ async fn proxy_for_transform(
211
211
depot : & mut Depot ,
212
212
ctrl : & mut FlowCtrl ,
213
213
) -> Result < ( ) , anyhow:: Error > {
214
- dbg ! ( & req) ;
215
- let config: Config = Config :: dynamic ( req) . extract ( ) . unwrap ( ) ;
216
- let content_type = get_content_type_from_headers ( req. headers_mut ( ) ) ;
217
214
let proxy = default_proxy ( ) ;
218
215
let headers_ori = req. headers ( ) . clone ( ) ;
219
216
req. headers_mut ( ) . insert ( http:: header:: ACCEPT , header:: HeaderValue :: from_static ( "application/json" ) ) ;
@@ -524,13 +521,14 @@ pub async fn direct_stream_fallback(
524
521
return Ok ( ( ) ) ;
525
522
}
526
523
527
- proxy_for_transform. handle ( req, depot, res, ctrl) . await ;
524
+ let mut res_upstream = & mut Response :: new ( ) ;
525
+ proxy_for_transform. handle ( req, depot, res_upstream, ctrl) . await ;
528
526
529
- match res . status_code . unwrap ( ) {
527
+ match res_upstream . status_code . unwrap ( ) {
530
528
http:: StatusCode :: OK => {
531
529
let container: MediaContainerWrapper < MediaContainer > =
532
530
//from_reqwest_response(upstream_res).await?;
533
- from_salvo_response ( res ) . await ?;
531
+ from_salvo_response ( res_upstream ) . await ?;
534
532
535
533
if container. media_container . general_decision_code . is_some ( )
536
534
&& container. media_container . general_decision_code . unwrap ( ) == 2000
@@ -552,13 +550,13 @@ pub async fn direct_stream_fallback(
552
550
//return Ok(());
553
551
} ,
554
552
status => {
555
- tracing:: error!( status = ?status, res = ?res , "Failed to get plex response" ) ;
553
+ tracing:: error!( status = ?status, res = ?res_upstream , "Failed to get plex response" ) ;
556
554
return Err (
557
555
salvo:: http:: StatusError :: internal_server_error ( ) . into ( )
558
556
) ;
559
557
}
560
558
} ;
561
-
559
+ //res = &mut Response::new();
562
560
return Ok ( ( ) ) ;
563
561
}
564
562
0 commit comments