mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
add content_type for basic example response body to decode utf-8 correctly (#586)
This commit is contained in:
parent
6fe45afe69
commit
32022a5ec1
@ -58,7 +58,9 @@ async fn default_handler(req_method: Method) -> Result<impl Responder> {
|
||||
async fn response_body(path: web::Path<String>) -> HttpResponse {
|
||||
let name = path.into_inner();
|
||||
|
||||
HttpResponse::Ok().streaming(stream! {
|
||||
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("!"));
|
||||
|
Loading…
Reference in New Issue
Block a user