Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update actix-web depedency to 4.0.0 #331

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doctest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Chris Wong <[email protected]>"]
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"
Expand Down
4 changes: 2 additions & 2 deletions maud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
16 changes: 8 additions & 8 deletions maud/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
Expand Down