@@ -11,7 +11,7 @@ use ser::{
1111 MachineUpdateRequestSer , ResponseErrorSer ,
1212} ;
1313use wstd:: http:: request:: JsonRequest ;
14- use wstd:: http:: { Client , IntoBody as _ , Method , StatusCode } ;
14+ use wstd:: http:: { Client , Method , StatusCode } ;
1515use wstd:: runtime:: block_on;
1616
1717// These structs are internal implementation details. They are designed to serialize
@@ -393,14 +393,11 @@ async fn create(
393393 config : fly_config,
394394 region,
395395 } ;
396- let body = serde_json:: to_string ( & request_payload) . expect ( "must be serializable" ) ;
397-
398396 let url = format ! ( "{API_BASE_URL}/apps/{app_name}/machines" ) ;
399397 let request = request_with_api_token ( ) ?
400398 . method ( Method :: POST )
401399 . uri ( url)
402- . header ( "Content-Type" , "application/json" )
403- . body ( body. into_body ( ) ) ?;
400+ . json ( & request_payload) ?;
404401
405402 let response = Client :: new ( ) . send ( request) . await ?;
406403 if response. status ( ) . is_success ( ) {
@@ -451,14 +448,11 @@ async fn update(
451448 config : machine_config,
452449 region,
453450 } ;
454- let body = serde_json:: to_string ( & request_payload) . expect ( "must be serializable" ) ;
455-
456451 let url = format ! ( "{API_BASE_URL}/apps/{app_name}/machines/{machine_id}" ) ;
457452 let request = request_with_api_token ( ) ?
458453 . method ( Method :: POST )
459454 . uri ( url)
460- . header ( "Content-Type" , "application/json" )
461- . body ( body. into_body ( ) ) ?;
455+ . json ( & request_payload) ?;
462456
463457 let response = Client :: new ( ) . send ( request) . await ?;
464458 if response. status ( ) . is_success ( ) {
0 commit comments