Skip to content

Commit 69b9020

Browse files
l1xlazear
authored andcommitted
Fixing example
1 parent c47ebe0 commit 69b9020

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

examples/main.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use axum::extract::State;
2+
use axum::http::header::{ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN};
23
use axum::response::IntoResponse;
34
use axum::{
45
routing::{get, post},
56
Json, Router,
67
};
7-
use http::header::{ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN};
8-
use http::Request;
8+
use hyper::Request;
99
use hyper::{Body, StatusCode};
1010
use serde::{Deserialize, Serialize};
1111
use std::sync::{Arc, Mutex};
@@ -54,13 +54,7 @@ async fn main() {
5454

5555
// Set up CORS
5656
let cors_layer = CorsLayer::new()
57-
.allow_headers(vec![
58-
ACCEPT,
59-
ACCEPT_ENCODING,
60-
AUTHORIZATION,
61-
CONTENT_TYPE,
62-
ORIGIN,
63-
])
57+
.allow_headers([ACCEPT, ACCEPT_ENCODING, AUTHORIZATION, CONTENT_TYPE, ORIGIN])
6458
.allow_methods(tower_http::cors::Any)
6559
.allow_origin(tower_http::cors::Any);
6660

0 commit comments

Comments
 (0)