aboutsummaryrefslogtreecommitdiff
path: root/examples/form/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/form/src/main.rs')
-rw-r--r--examples/form/src/main.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/form/src/main.rs b/examples/form/src/main.rs
index 9e6748e..a63560c 100644
--- a/examples/form/src/main.rs
+++ b/examples/form/src/main.rs
@@ -4,7 +4,7 @@ use hyper::{Method, Server, StatusCode, Body};
use hyper::http::request::Parts;
use hyper::http::response::Builder;
use serde::Deserialize;
-use sputnik::{mime, request::SputnikParts, response::SputnikBuilder};
+use sputnik::{html_escape, mime, request::SputnikParts, response::SputnikBuilder};
use sputnik::hyper_body::{SputnikBody, FormError};
type Response = hyper::Response<Body>;
@@ -45,8 +45,8 @@ struct FormData {text: String}
async fn post_form(_req: &mut Parts, body: Body) -> Result<Response, Error> {
let msg: FormData = body.into_form().await?;
- Ok(Builder::new().body(
- format!("hello {}", msg.text).into()
+ Ok(Builder::new().content_type(mime::TEXT_HTML).body(
+ format!("hello <em>{}</em>", html_escape(msg.text)).into()
).unwrap())
}