@@ -1109,15 +1109,19 @@ where
11091109pub const CONVEX_CHEF_DEPLOY_SECRET_HEADER : HeaderName =
11101110 HeaderName :: from_static ( "convex-chef-deploy-secret" ) ;
11111111
1112- pub struct ExtractChefDeploySecret ( pub Option < String > ) ;
1112+ pub struct ExtractChefDeploySecret ( pub String ) ;
11131113
1114- fn chef_deploy_secret_from_req_parts ( parts : & mut axum :: http :: request :: Parts ) -> Option < String > {
1115- // TODO(jordan): Once chef is pushed, this should no longer be optional and we
1116- // should throw an error if it's not present
1114+ fn chef_deploy_secret_from_req_parts (
1115+ parts : & mut axum :: http :: request :: Parts ,
1116+ ) -> anyhow :: Result < String > {
11171117 parts
11181118 . headers
11191119 . get ( CONVEX_CHEF_DEPLOY_SECRET_HEADER )
11201120 . and_then ( |h| h. to_str ( ) . ok ( ) . map ( |s| s. to_string ( ) ) )
1121+ . context ( ErrorMetadata :: bad_request (
1122+ "InvalidChefDeploySecret" ,
1123+ "convex-chef-deploy-secret header is not set" ,
1124+ ) )
11211125}
11221126
11231127impl < S > FromRequestParts < S > for ExtractChefDeploySecret
@@ -1130,7 +1134,7 @@ where
11301134 parts : & mut axum:: http:: request:: Parts ,
11311135 _state : & S ,
11321136 ) -> Result < Self , Self :: Rejection > {
1133- let shared_secret = chef_deploy_secret_from_req_parts ( parts) ;
1137+ let shared_secret = chef_deploy_secret_from_req_parts ( parts) ? ;
11341138 Ok ( Self ( shared_secret) )
11351139 }
11361140}
0 commit comments