File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,18 @@ pub mod jsonapi;
7
7
mod tempo;
8
8
9
9
use axum:: {
10
- http:: header:: { ACCEPT , AUTHORIZATION , CONTENT_TYPE } ,
10
+ http:: {
11
+ header:: { ACCEPT , AUTHORIZATION , CONTENT_TYPE } ,
12
+ Method ,
13
+ } ,
11
14
Router ,
12
15
} ;
13
16
use base:: database:: get_database;
14
17
pub use error:: Error ;
15
18
use eyre:: Result ;
16
19
use sea_orm:: DbConn ;
17
20
use tower_http:: {
18
- cors:: { AllowOrigin , Any , CorsLayer } ,
21
+ cors:: { AllowOrigin , CorsLayer } ,
19
22
trace:: TraceLayer ,
20
23
} ;
21
24
@@ -24,8 +27,16 @@ pub struct AppState(pub DbConn);
24
27
25
28
pub fn router ( ) -> Result < Router > {
26
29
let cors = CorsLayer :: new ( )
27
- . allow_methods ( Any )
30
+ . allow_methods ( [
31
+ Method :: OPTIONS ,
32
+ Method :: HEAD ,
33
+ Method :: GET ,
34
+ Method :: POST ,
35
+ Method :: PUT ,
36
+ Method :: PATCH ,
37
+ ] )
28
38
. allow_origin ( AllowOrigin :: mirror_request ( ) )
39
+ . allow_credentials ( true )
29
40
. allow_headers ( [ AUTHORIZATION , ACCEPT , CONTENT_TYPE ] ) ;
30
41
let tracing = TraceLayer :: new_for_http ( ) ;
31
42
let conn = get_database ( ) ?. clone ( ) ;
You can’t perform that action at this time.
0 commit comments