From 69b90206d43c465c147445fa0b08cecbc4c46b8f Mon Sep 17 00:00:00 2001 From: Istvan Szukacs Date: Tue, 12 Dec 2023 12:55:34 +0100 Subject: [PATCH] Fixing example --- examples/main.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/examples/main.rs b/examples/main.rs index be817b8..6f9bf17 100644 --- a/examples/main.rs +++ b/examples/main.rs @@ -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}; @@ -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);