Expand description
Reply with a body and content-type
set to text/html; charset=utf-8
.
Example
use warp::Filter;
let body = r#"
<html>
<head>
<title>HTML with warp!</title>
</head>
<body>
<h1>warp + HTML = :heart:</h1>
</body>
</html>
"#;
let route = warp::any()
.map(|| {
warp::reply::html(body)
});
Note
If a type fails to be serialized into JSON, the error is logged at the
error
level, and the returned impl Reply
will be an empty
500 Internal Server Error
response.