Update to tower-http 0.3.0 (#965)

* Update to tower-http 0.3.0

* changelog link
This commit is contained in:
David Pedersen
2022-04-25 14:59:16 +00:00
committed by GitHub
parent ebecac57a3
commit 79f6cde3b1
14 changed files with 18 additions and 16 deletions
+3 -3
View File
@@ -5,13 +5,13 @@
//! ```
use axum::{
http::Method,
http::{HeaderValue, Method},
response::{Html, IntoResponse},
routing::get,
Json, Router,
};
use std::net::SocketAddr;
use tower_http::cors::{CorsLayer, Origin};
use tower_http::cors::CorsLayer;
#[tokio::main]
async fn main() {
@@ -29,7 +29,7 @@ async fn main() {
// it is required to add ".allow_headers(vec![http::header::CONTENT_TYPE])"
// or see this issue https://github.com/tokio-rs/axum/issues/849
CorsLayer::new()
.allow_origin(Origin::exact("http://localhost:3000".parse().unwrap()))
.allow_origin("http://localhost:3000".parse::<HeaderValue>().unwrap())
.allow_methods(vec![Method::GET]),
);
serve(app, 4000).await;