Skip to content

Commit

Permalink
fix(cors): allow put method
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Jul 11, 2022
1 parent 9925571 commit 8389b6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/middlewares/cors.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
use std::str::FromStr;

use axum::http::header::*;
use axum::http::Method;
use std::str::FromStr;
use tower_http::cors::{Any, CorsLayer};

pub fn handle() -> CorsLayer {
CorsLayer::new()
.allow_origin(Any)
.allow_methods([
Method::GET,
Method::DELETE,
Method::GET,
Method::HEAD,
Method::OPTIONS,
Method::PATCH,
Method::POST,
Method::OPTIONS,
Method::HEAD,
Method::PUT,
])
.allow_headers([
ACCEPT,
AUTHORIZATION,
CONTENT_TYPE,
CONTENT_LENGTH,
CONTENT_TYPE,
HeaderName::from_str("X-Captcha-Key").unwrap(),
])
}

0 comments on commit 8389b6e

Please sign in to comment.