Update actix-web depedency to 4.0.0 (#331)
This commit is contained in:
parent
26cdad9991
commit
e6787cd621
4 changed files with 13 additions and 11 deletions
|
@ -6,6 +6,8 @@
|
||||||
[#320](https://github.com/lambda-fairy/maud/pull/320)
|
[#320](https://github.com/lambda-fairy/maud/pull/320)
|
||||||
- Update to axum-core 0.1. This requires axum 0.4
|
- Update to axum-core 0.1. This requires axum 0.4
|
||||||
[#325](https://github.com/lambda-fairy/maud/pull/325)
|
[#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
|
## [0.23.0] - 2021-11-10
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ authors = ["Chris Wong <lambda.fairy@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "3"
|
actix-web = { version = "4.0.0-rc.2", default-features = false, features = ["macros"] }
|
||||||
ammonia = "3"
|
ammonia = "3"
|
||||||
maud = { path = "../maud", features = ["actix-web", "rocket", "tide", "axum"] }
|
maud = { path = "../maud", features = ["actix-web", "rocket", "tide", "axum"] }
|
||||||
pulldown-cmark = "0.8"
|
pulldown-cmark = "0.8"
|
||||||
|
|
|
@ -13,17 +13,17 @@ edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
axum = ["axum-core", "http"]
|
|
||||||
|
|
||||||
# Web framework integrations
|
# Web framework integrations
|
||||||
actix-web = ["actix-web-dep", "futures-util"]
|
actix-web = ["actix-web-dep", "futures-util"]
|
||||||
|
axum = ["axum-core", "http"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
maud_macros = { version = "0.23.0", path = "../maud_macros" }
|
maud_macros = { version = "0.23.0", path = "../maud_macros" }
|
||||||
itoa = { version = "0.4.8", default-features = false, features = ["i128"] }
|
itoa = { version = "0.4.8", default-features = false, features = ["i128"] }
|
||||||
rocket = { version = ">= 0.3, < 0.5", optional = true }
|
rocket = { version = ">= 0.3, < 0.5", optional = true }
|
||||||
futures-util = { version = "0.3.0", optional = true, default-features = false }
|
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 }
|
tide = { version = "0.16.0", optional = true, default-features = false }
|
||||||
axum-core = { version = "0.1", optional = true }
|
axum-core = { version = "0.1", optional = true }
|
||||||
http = { version = "0.2", optional = true }
|
http = { version = "0.2", optional = true }
|
||||||
|
|
|
@ -262,17 +262,17 @@ mod rocket_support {
|
||||||
#[cfg(feature = "actix-web")]
|
#[cfg(feature = "actix-web")]
|
||||||
mod actix_support {
|
mod actix_support {
|
||||||
use crate::PreEscaped;
|
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 alloc::string::String;
|
||||||
use futures_util::future::{ok, Ready};
|
|
||||||
|
|
||||||
impl Responder for PreEscaped<String> {
|
impl Responder for PreEscaped<String> {
|
||||||
type Error = Error;
|
type Body = String;
|
||||||
type Future = Ready<Result<HttpResponse, Self::Error>>;
|
|
||||||
fn respond_to(self, _req: &HttpRequest) -> Self::Future {
|
fn respond_to(self, _req: &HttpRequest) -> HttpResponse<Self::Body> {
|
||||||
ok(HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.content_type("text/html; charset=utf-8")
|
.content_type(header::ContentType::html())
|
||||||
.body(self.0))
|
.message_body(self.0)
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue