diff --git a/integrations/actix/src/lib.rs b/integrations/actix/src/lib.rs index e8bc1d7df..96cc83099 100644 --- a/integrations/actix/src/lib.rs +++ b/integrations/actix/src/lib.rs @@ -212,7 +212,8 @@ where IV: IntoView let tail = ""; - let html_stream = futures::stream::once(async move { head.clone() }) + HttpResponse::Ok().content_type("text/html").streaming( + futures::stream::once(async move { head.clone() }) .chain(render_to_stream_with_prefix( app, |cx| { @@ -222,11 +223,8 @@ where IV: IntoView format!("{head}").into() } )) - .chain(futures::stream::once(async { tail.to_string() })); - - HttpResponse::Ok().content_type("text/html").streaming( - html_stream - .map(|html| Ok(web::Bytes::from(html)) as Result), + .chain(futures::stream::once(async { tail.to_string() })) + .map(|html| Ok(web::Bytes::from(html)) as Result), ) } })