File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
wundergraph_cli/src/print_schema Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -328,24 +328,22 @@ mod tests {
328328 client : & reqwest:: Client ,
329329 listen_url : & str ,
330330 body : & ' static str ,
331- ) -> Result < ( ) , std:: string:: String > {
332- let r = client
331+ ) -> Result < ( ) , String > {
332+ fn error_mapper < T : std:: fmt:: Debug > ( e : T ) -> String {
333+ format ! ( "{:?}" , e)
334+ }
335+
336+ let mut r = client
333337 . post ( & format ! ( "http://{}/graphql" , listen_url) )
334338 . body ( body)
335339 . header (
336340 reqwest:: header:: CONTENT_TYPE ,
337341 reqwest:: header:: HeaderValue :: from_static ( "application/json" ) ,
338342 )
339- . send ( ) ;
340- match r {
341- Ok ( mut r) => match r. json :: < serde_json:: Value > ( ) {
342- Ok ( r) => match std:: panic:: catch_unwind ( || insta:: assert_json_snapshot!( r) ) {
343- Ok ( _) => Ok ( ( ) ) ,
344- Err ( e) => Err ( format ! ( "{:?}" , e) ) ,
345- } ,
346- Err ( e) => Err ( format ! ( "{:?}" , e) ) ,
347- } ,
348- Err ( e) => Err ( format ! ( "{:?}" , e) ) ,
349- }
343+ . send ( )
344+ . map_err ( error_mapper) ?;
345+ let r = r. json :: < serde_json:: Value > ( ) . map_err ( error_mapper) ?;
346+ std:: panic:: catch_unwind ( || insta:: assert_json_snapshot!( r) ) . map_err ( error_mapper) ?;
347+ Ok ( ( ) )
350348 }
351349}
You can’t perform that action at this time.
0 commit comments