Set appropriate contenttype
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
b98bcf09f2
commit
b5efd31fdd
3 changed files with 5 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -991,6 +991,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"base64 0.20.0",
|
"base64 0.20.0",
|
||||||
|
"mime",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -10,3 +10,4 @@ serde = { version = "1.0", features = ["derive"] }
|
||||||
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] }
|
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] }
|
||||||
serde_json = "1.0.89"
|
serde_json = "1.0.89"
|
||||||
base64 = "0.20.0"
|
base64 = "0.20.0"
|
||||||
|
mime = "0.3.16"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use actix_web::{get, App, HttpResponse, HttpServer, Responder, web::{Data, Query}};
|
use actix_web::{get, App, HttpResponse, HttpServer, Responder, web::{Data, Query}, http::header::ContentType};
|
||||||
use tera::{Tera, Context};
|
use tera::{Tera, Context};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use reqwest::{Client, header::HeaderMap};
|
use reqwest::{Client, header::HeaderMap};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use mime::TEXT_HTML;
|
||||||
|
|
||||||
struct Template {
|
struct Template {
|
||||||
paste: Tera,
|
paste: Tera,
|
||||||
|
@ -54,7 +55,7 @@ async fn paste_render(data: Data<Template>, paste: Query<Paste>) -> impl Respond
|
||||||
}
|
}
|
||||||
context.insert("paste_content", &paste_content);
|
context.insert("paste_content", &paste_content);
|
||||||
let rendered = my_data.paste.render("paste.html", &context);
|
let rendered = my_data.paste.render("paste.html", &context);
|
||||||
HttpResponse::Ok().body(rendered.unwrap())
|
HttpResponse::Ok().insert_header(ContentType(TEXT_HTML)).body(rendered.unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
|
|
Loading…
Reference in a new issue