♻️ refactor: standardize the content-type
header by using an enum value over typing it manually (#474)
* ♻️ refactor: change content-type * 🐛 fix: change parameters that were passed to the settings function --------- Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
This commit is contained in:
parent
5b4864424a
commit
5020f36c90
2 changed files with 47 additions and 57 deletions
|
@ -11,7 +11,7 @@ use crate::{
|
|||
},
|
||||
results::aggregator::aggregate,
|
||||
};
|
||||
use actix_web::{get, web, HttpRequest, HttpResponse};
|
||||
use actix_web::{get, http::header::ContentType, web, HttpRequest, HttpResponse};
|
||||
use regex::Regex;
|
||||
use std::{
|
||||
fs::File,
|
||||
|
@ -68,18 +68,16 @@ pub async fn search(
|
|||
get_results(page + 1)
|
||||
);
|
||||
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(
|
||||
crate::templates::views::search::search(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
query,
|
||||
&results?,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
Ok(HttpResponse::Ok().content_type(ContentType::html()).body(
|
||||
crate::templates::views::search::search(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
query,
|
||||
&results?,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
}
|
||||
None => Ok(HttpResponse::TemporaryRedirect()
|
||||
.insert_header(("location", "/"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue