4
0
Fork 0
mirror of https://github.com/zzzzDev4/ias-tea-axum.git synced 2025-04-21 07:41:21 +02:00

added allow_headers call

This commit is contained in:
zzzz 2024-06-16 17:19:25 +02:00
parent ef5bcb20a5
commit 38101afe8e

View file

@ -3,8 +3,7 @@
// cargo shuttle resource list --show-secrets // cargo shuttle resource list --show-secrets
use axum::{ use axum::{
routing::{get, post, put, delete}, http, routing::{delete, get, post, put}, Router
Router,
}; };
use axum::http::Method; use axum::http::Method;
use data::MyState; use data::MyState;
@ -47,6 +46,7 @@ async fn main(#[shuttle_shared_db::Postgres] pool: PgPool) -> shuttle_axum::Shut
.with_state(state) .with_state(state)
.layer(tower_http::cors::CorsLayer::new() .layer(tower_http::cors::CorsLayer::new()
.allow_methods([Method::GET, Method::POST, Method::PUT, Method::DELETE]) .allow_methods([Method::GET, Method::POST, Method::PUT, Method::DELETE])
.allow_headers([http::header::CONTENT_TYPE])
.allow_origin(tower_http::cors::Any)); .allow_origin(tower_http::cors::Any));
Ok(router.into()) Ok(router.into())