Update actix-web depedency to 4.0.0 ()

This commit is contained in:
Rob Ede 2022-02-28 00:28:57 +00:00 committed by GitHub
parent 26cdad9991
commit e6787cd621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View file

@ -6,6 +6,8 @@
[#320](https://github.com/lambda-fairy/maud/pull/320)
- Update to axum-core 0.1. This requires axum 0.4
[#325](https://github.com/lambda-fairy/maud/pull/325)
- Update to `actix-web` 4.0.
[#331](https://github.com/lambda-fairy/maud/pull/331)
## [0.23.0] - 2021-11-10

View file

@ -5,7 +5,7 @@ authors = ["Chris Wong <lambda.fairy@gmail.com>"]
edition = "2018"
[dependencies]
actix-web = "3"
actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] }
ammonia = "3"
maud = { path = "../maud", features = ["actix-web", "rocket", "tide", "axum"] }
pulldown-cmark = "0.8"

View file

@ -13,17 +13,17 @@ edition = "2021"
[features]
default = []
axum = ["axum-core", "http"]
# Web framework integrations
actix-web = ["actix-web-dep", "futures-util"]
axum = ["axum-core", "http"]
[dependencies]
maud_macros = { version = "0.23.0", path = "../maud_macros" }
itoa = { version = "0.4.8", default-features = false, features = ["i128"] }
rocket = { version = ">= 0.3, < 0.5", optional = true }
futures-util = { version = "0.3.0", optional = true, default-features = false }
actix-web-dep = { package = "actix-web", version = ">= 2, < 4", optional = true, default-features = false }
actix-web-dep = { package = "actix-web", version = "4", optional = true, default-features = false }
tide = { version = "0.16.0", optional = true, default-features = false }
axum-core = { version = "0.1", optional = true }
http = { version = "0.2", optional = true }

View file

@ -262,17 +262,17 @@ mod rocket_support {
#[cfg(feature = "actix-web")]
mod actix_support {
use crate::PreEscaped;
use actix_web_dep::{Error, HttpRequest, HttpResponse, Responder};
use actix_web_dep::{http::header, HttpRequest, HttpResponse, Responder};
use alloc::string::String;
use futures_util::future::{ok, Ready};
impl Responder for PreEscaped<String> {
type Error = Error;
type Future = Ready<Result<HttpResponse, Self::Error>>;
fn respond_to(self, _req: &HttpRequest) -> Self::Future {
ok(HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(self.0))
type Body = String;
fn respond_to(self, _req: &HttpRequest) -> HttpResponse<Self::Body> {
HttpResponse::Ok()
.content_type(header::ContentType::html())
.message_body(self.0)
.unwrap()
}
}
}