@@ -129,13 +129,14 @@ impl AsyncClient {
129129        let  url = format ! ( "{}{}" ,  self . url,  path) ; 
130130        let  response = self . client . get ( url) . send ( ) . await ?; 
131131
132-         match  response. status ( ) . is_success ( )  { 
133-             true  => Ok ( response. json :: < T > ( ) . await . map_err ( Error :: Reqwest ) ?) , 
134-             false  => Err ( Error :: HttpResponse  { 
132+         if  !response. status ( ) . is_success ( )  { 
133+             return  Err ( Error :: HttpResponse  { 
135134                status :  response. status ( ) . as_u16 ( ) , 
136135                message :  response. text ( ) . await ?, 
137-             } ) , 
136+             } ) ; 
138137        } 
138+ 
139+         response. json :: < T > ( ) . await . map_err ( Error :: Reqwest ) 
139140    } 
140141
141142    /// Make an HTTP GET request to given URL, deserializing to `Option<T>`. 
@@ -173,17 +174,15 @@ impl AsyncClient {
173174        let  url = format ! ( "{}{}" ,  self . url,  path) ; 
174175        let  response = self . client . get ( url) . send ( ) . await ?; 
175176
176-         match  response. status ( ) . is_success ( )  { 
177-             true  => { 
178-                 let  hex_str = response. text ( ) . await ?; 
179-                 let  hex_vec = Vec :: from_hex ( & hex_str) ?; 
180-                 Ok ( deserialize ( & hex_vec) ?) 
181-             } 
182-             false  => Err ( Error :: HttpResponse  { 
177+         if  !response. status ( ) . is_success ( )  { 
178+             return  Err ( Error :: HttpResponse  { 
183179                status :  response. status ( ) . as_u16 ( ) , 
184180                message :  response. text ( ) . await ?, 
185-             } ) , 
181+             } ) ; 
186182        } 
183+ 
184+         let  hex_str = response. text ( ) . await ?; 
185+         Ok ( deserialize ( & Vec :: from_hex ( & hex_str) ?) ?) 
187186    } 
188187
189188    /// Make an HTTP GET request to given URL, deserializing to `Option<T>`. 
@@ -215,13 +214,14 @@ impl AsyncClient {
215214        let  url = format ! ( "{}{}" ,  self . url,  path) ; 
216215        let  response = self . client . get ( url) . send ( ) . await ?; 
217216
218-         match  response. status ( ) . is_success ( )  { 
219-             true  => Ok ( response. text ( ) . await ?) , 
220-             false  => Err ( Error :: HttpResponse  { 
217+         if  !response. status ( ) . is_success ( )  { 
218+             return  Err ( Error :: HttpResponse  { 
221219                status :  response. status ( ) . as_u16 ( ) , 
222220                message :  response. text ( ) . await ?, 
223-             } ) , 
221+             } ) ; 
224222        } 
223+ 
224+         Ok ( response. text ( ) . await ?) 
225225    } 
226226
227227    /// Make an HTTP GET request to given URL, deserializing to `Option<T>`. 
@@ -257,13 +257,14 @@ impl AsyncClient {
257257
258258        let  response = self . client . post ( url) . body ( body) . send ( ) . await ?; 
259259
260-         match  response. status ( ) . is_success ( )  { 
261-             true  => Ok ( ( ) ) , 
262-             false  => Err ( Error :: HttpResponse  { 
260+         if  !response. status ( ) . is_success ( )  { 
261+             return  Err ( Error :: HttpResponse  { 
263262                status :  response. status ( ) . as_u16 ( ) , 
264263                message :  response. text ( ) . await ?, 
265-             } ) , 
264+             } ) ; 
266265        } 
266+ 
267+         Ok ( ( ) ) 
267268    } 
268269
269270    /// Get a [`Transaction`] option given its [`Txid`] 
0 commit comments