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

Upgrading versions #7

Merged
merged 2 commits into from
Dec 12, 2023
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
13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Tower Layer for compatibility between Axum and AWS Lambda Runtime
readme = "README.md"
homepage = "https://github.com/lazear/axum-aws-lambda"
repository = "https://github.com/lazear/axum-aws-lambda"
license ="MIT"
license = "MIT"
keywords = ["axum", "lambda", "tower", "aws"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -16,14 +16,19 @@ keywords = ["axum", "lambda", "tower", "aws"]
axum = "0.6"
lambda_http = "0.8"
hyper = "0.14"
bytes = "1"
http = "0.2"
bytes = "1.5"
http = "1"
tower = "0.4"
tower-service = "0.3"

[dev-dependencies]
tokio = { version = "1.0", features = ["rt"] }
tower-http = { version = "0.4", features = ["cors", "compression-gzip", "compression-deflate", "trace"] }
tower-http = { version = "0.4", features = [
"cors",
"compression-gzip",
"compression-deflate",
"trace",
] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
12 changes: 3 additions & 9 deletions examples/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use axum::extract::State;
use axum::http::header::{ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN};
use axum::response::IntoResponse;
use axum::{
routing::{get, post},
Json, Router,
};
use http::header::{ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN};
use http::Request;
use hyper::Request;
use hyper::{Body, StatusCode};
use serde::{Deserialize, Serialize};
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -54,13 +54,7 @@ async fn main() {

// Set up CORS
let cors_layer = CorsLayer::new()
.allow_headers(vec![
ACCEPT,
ACCEPT_ENCODING,
AUTHORIZATION,
CONTENT_TYPE,
ORIGIN,
])
.allow_headers([ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN])
.allow_methods(tower_http::cors::Any)
.allow_origin(tower_http::cors::Any);

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use axum::response::IntoResponse;
use http::Uri;
use lambda_http::RequestExt;
use std::{future::Future, pin::Pin};
use tower::Layer;
Expand Down Expand Up @@ -77,7 +76,7 @@ where
url.push('?');
url.push_str(query);
}
parts.uri = url.parse::<Uri>().unwrap();
parts.uri = url.parse::<hyper::Uri>().unwrap();
}

let request = axum::http::Request::from_parts(parts, body);
Expand Down