File tree Expand file tree Collapse file tree
libs/@local/graph/api/src/rest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,24 +175,27 @@ pub struct JsonCompatHeader(pub bool);
175175impl < S : Sync > FromRequestParts < S > for JsonCompatHeader {
176176 type Rejection = ( StatusCode , Cow < ' static , str > ) ;
177177
178- async fn from_request_parts ( parts : & mut Parts , _state : & S ) -> Result < Self , Self :: Rejection > {
178+ fn from_request_parts (
179+ parts : & mut Parts ,
180+ _state : & S ,
181+ ) -> impl Future < Output = Result < Self , Self :: Rejection > > + Send {
179182 let Some ( value) = parts. headers . get ( "Json-Compat" ) else {
180- return Ok ( Self ( false ) ) ;
183+ return core :: future :: ready ( Ok ( Self ( false ) ) ) ;
181184 } ;
182185
183186 let bytes = value. as_ref ( ) ;
184187 if bytes. eq_ignore_ascii_case ( b"true" ) || bytes. eq_ignore_ascii_case ( b"1" ) {
185- return Ok ( Self ( true ) ) ;
188+ return core :: future :: ready ( Ok ( Self ( true ) ) ) ;
186189 }
187190
188191 if bytes. eq_ignore_ascii_case ( b"false" ) || bytes. eq_ignore_ascii_case ( b"0" ) {
189- return Ok ( Self ( false ) ) ;
192+ return core :: future :: ready ( Ok ( Self ( false ) ) ) ;
190193 }
191194
192- Err ( (
195+ core :: future :: ready ( Err ( (
193196 StatusCode :: BAD_REQUEST ,
194197 Cow :: Borrowed ( "`Json-Compat` header must be either `true` (`1`) or `false` (`0`)" ) ,
195- ) )
198+ ) ) )
196199 }
197200}
198201
You can’t perform that action at this time.
0 commit comments