Skip to content

Commit

Permalink
Support axum v0.7 through axum-core v0.4 and http v1 (#401)
Browse files Browse the repository at this point in the history
* chore: bump `axum-core` for use with new `axum` 0.7 release

* chore: bump doctest axum too

* chore: update changelog

* chore: fix changelog

* fix: doctest

* fix: import right resp type

* fix: bump http as well

* fix: doctest

* Update CHANGELOG.md
  • Loading branch information
vidhanio committed Dec 30, 2023
1 parent 8318963 commit d3b8711
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
[#380](https://github.com/lambda-fairy/maud/pull/380)
- Accept literals in attribute names
[#396](https://github.com/lambda-fairy/maud/pull/396)
- Support `axum` v0.7 through `axum-core` v0.4 and `http` v1
[#401](https://github.com/lambda-fairy/maud/pull/401)

## [0.25.0] - 2023-04-16

Expand Down
7 changes: 3 additions & 4 deletions docs/content/web-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ async fn main() {
let app = Router::new().route("/", get(hello_world));
// run it with hyper on localhost:3000
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app.into_make_service()).await.unwrap();
}
```
2 changes: 1 addition & 1 deletion doctest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rocket = "0.4"
rouille = "3"
tide = "0.16"
tokio = { version = "1.9.0", features = ["rt", "macros", "rt-multi-thread"] }
axum = "0.6"
axum = "0.7"

[dependencies.async-std]
version = "1.9.0"
Expand Down
4 changes: 2 additions & 2 deletions maud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ 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 = "4", optional = true, default-features = false }
tide = { version = "0.16.0", optional = true, default-features = false }
axum-core = { version = "0.3", optional = true }
http = { version = "0.2", optional = true }
axum-core = { version = "0.4", optional = true }
http = { version = "1", optional = true }

[dev-dependencies]
trybuild = { version = "1.0.33", features = ["diff"] }
Expand Down
6 changes: 3 additions & 3 deletions maud/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ mod tide_support {
mod axum_support {
use crate::PreEscaped;
use alloc::string::String;
use axum_core::{body::BoxBody, response::IntoResponse};
use http::{header, HeaderMap, HeaderValue, Response};
use axum_core::response::{IntoResponse, Response};
use http::{header, HeaderMap, HeaderValue};

impl IntoResponse for PreEscaped<String> {
fn into_response(self) -> Response<BoxBody> {
fn into_response(self) -> Response {
let mut headers = HeaderMap::new();
headers.insert(
header::CONTENT_TYPE,
Expand Down

0 comments on commit d3b8711

Please sign in to comment.