diff --git a/basics/basics/src/main.rs b/basics/basics/src/main.rs index 305d1251..6f95fe81 100644 --- a/basics/basics/src/main.rs +++ b/basics/basics/src/main.rs @@ -58,11 +58,13 @@ async fn default_handler(req_method: Method) -> Result { async fn response_body(path: web::Path) -> HttpResponse { let name = path.into_inner(); - HttpResponse::Ok().streaming(stream! { - yield Ok::<_, Infallible>(web::Bytes::from("Hello ")); - yield Ok::<_, Infallible>(web::Bytes::from(name)); - yield Ok::<_, Infallible>(web::Bytes::from("!")); - }) + HttpResponse::Ok() + .content_type(ContentType::plaintext()) + .streaming(stream! { + yield Ok::<_, Infallible>(web::Bytes::from("Hello ")); + yield Ok::<_, Infallible>(web::Bytes::from(name)); + yield Ok::<_, Infallible>(web::Bytes::from("!")); + }) } /// handler with path parameters like `/user/{name}/`