upgrading to actix-v4-beta

This commit is contained in:
realaravinth
2021-06-30 20:13:12 +05:30
parent 9ed458ebfa
commit 9f940c317a
24 changed files with 728 additions and 1192 deletions

View File

@@ -62,7 +62,7 @@ pub fn handle_embedded_file(path: &str) -> HttpResponse {
Cow::Owned(bytes) => bytes.into(),
};
HttpResponse::Ok()
.set(header::CacheControl(vec![header::CacheDirective::MaxAge(
.insert_header(header::CacheControl(vec![header::CacheDirective::MaxAge(
CACHE_AGE,
)]))
.content_type(from_path(path).first_or_octet_stream().as_ref())
@@ -73,7 +73,7 @@ pub fn handle_embedded_file(path: &str) -> HttpResponse {
}
async fn dist(path: web::Path<String>) -> impl Responder {
handle_embedded_file(&path.0)
handle_embedded_file(&path)
}
async fn spec() -> HttpResponse {
@@ -101,7 +101,7 @@ mod tests {
let mut app = test::init_service(
App::new()
.wrap(actix_middleware::NormalizePath::new(
actix_middleware::normalize::TrailingSlash::Trim,
actix_middleware::TrailingSlash::Trim,
))
.configure(services),
)