@@ -106,20 +106,10 @@ impl<A: Adapter + 'static> Application<A> {
106
106
return map_response_error ( ResponseError :: BadRequest ( "invalid auth" . into ( ) ) ) ;
107
107
}
108
108
} ;
109
-
109
+
110
110
let mut response = match ( req. uri ( ) . path ( ) , req. method ( ) ) {
111
111
( "/cfg" , & Method :: GET ) => config ( req, & self ) . await ,
112
- ( "/channel" , & Method :: POST ) => {
113
- // example with middleware
114
- // @TODO remove later
115
- let req = match chain ( req, vec ! [ config_middleware] ) . await {
116
- Ok ( req) => req,
117
- Err ( error) => {
118
- return map_response_error ( error) ;
119
- }
120
- } ;
121
- create_channel ( req, & self ) . await
122
- }
112
+ ( "/channel" , & Method :: POST ) => create_channel ( req, & self ) . await ,
123
113
( "/channel/list" , & Method :: GET ) => Err ( ResponseError :: NotFound ) ,
124
114
// This is important becuase it prevents us from doing
125
115
// expensive regex matching for routes without /channel
@@ -135,6 +125,15 @@ impl<A: Adapter + 'static> Application<A> {
135
125
. map_or( "" . to_string( ) , |m| m. as_str( ) . to_string( ) ) ] ) ;
136
126
req. extensions_mut ( ) . insert ( param) ;
137
127
128
+ // example with middleware
129
+ // @TODO remove later
130
+ let req = match chain ( req, vec ! [ config_middleware] ) . await {
131
+ Ok ( req) => req,
132
+ Err ( error) => {
133
+ return map_response_error ( error) ;
134
+ }
135
+ } ;
136
+
138
137
last_approved ( req, & self ) . await
139
138
} else {
140
139
Err ( ResponseError :: NotFound )
0 commit comments