mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-11 12:31:25 +01:00
Slightly simplify CORS example (#1027)
This commit is contained in:
parent
0b856b938f
commit
591434778f
1 changed files with 2 additions and 2 deletions
|
@ -26,11 +26,11 @@ async fn main() {
|
|||
// for more details
|
||||
//
|
||||
// pay attention that for some request types like posting content-type: application/json
|
||||
// it is required to add ".allow_headers(vec![http::header::CONTENT_TYPE])"
|
||||
// it is required to add ".allow_headers([http::header::CONTENT_TYPE])"
|
||||
// or see this issue https://github.com/tokio-rs/axum/issues/849
|
||||
CorsLayer::new()
|
||||
.allow_origin("http://localhost:3000".parse::<HeaderValue>().unwrap())
|
||||
.allow_methods(vec![Method::GET]),
|
||||
.allow_methods([Method::GET]),
|
||||
);
|
||||
serve(app, 4000).await;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue