File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11use axum:: extract:: { MatchedPath , Request , State } ;
22use axum:: middleware:: Next ;
33use axum:: response:: { IntoResponse , Response } ;
4- use axum:: { Extension , Json } ;
4+ use axum:: Json ;
55use http:: { header, Method , StatusCode } ;
66use std:: str:: FromStr ;
77
@@ -36,12 +36,13 @@ impl FromStr for StatusCodeConfig {
3636/// Convert plain text errors into JSON errors and adjust status codes.
3737pub async fn middleware (
3838 State ( config) : State < StatusCodeConfig > ,
39- matched_path : Option < Extension < MatchedPath > > ,
4039 req : Request ,
4140 next : Next ,
4241) -> Response {
4342 let is_api_request = req. uri ( ) . path ( ) . starts_with ( "/api/" ) ;
44- let is_cargo_endpoint = matched_path
43+ let is_cargo_endpoint = req
44+ . extensions ( )
45+ . get :: < MatchedPath > ( )
4546 . map ( |m| is_cargo_endpoint ( req. method ( ) , m. as_str ( ) ) )
4647 . unwrap_or ( false ) ;
4748
You can’t perform that action at this time.
0 commit comments