@@ -345,7 +345,7 @@ private RestRequest newRequest(
345345 }
346346 else
347347 {
348- request . AddBody ( options . Data ) ;
348+ request . AddJsonBody ( options . Data ) ;
349349 }
350350 }
351351
@@ -416,15 +416,27 @@ private async Task<ApiResponse<T>> Exec<T>(RestRequest req, IReadableConfigurati
416416 var existingDeserializer = req . JsonSerializer as IDeserializer ;
417417 if ( existingDeserializer != null )
418418 {
419- client . AddHandler ( existingDeserializer , "application/json" , "text/json" , "text/x-json" , "text/javascript" , "*+json" , "*" ) ;
419+ client . AddHandler ( "application/json" , ( ) => existingDeserializer ) ;
420+ client . AddHandler ( "text/json" , ( ) => existingDeserializer ) ;
421+ client . AddHandler ( "text/x-json" , ( ) => existingDeserializer ) ;
422+ client . AddHandler ( "text/javascript" , ( ) => existingDeserializer ) ;
423+ client . AddHandler ( "*+json" , ( ) => existingDeserializer ) ;
424+ client . AddHandler ( "*" , ( ) => existingDeserializer ) ;
420425 }
421426 else
422427 {
423428 var codec = new CustomJsonCodec ( configuration ) ;
424- client . AddHandler ( codec , "application/json" , "text/json" , "text/x-json" , "text/javascript" , "*+json" , "*" ) ;
429+ client . AddHandler ( "application/json" , ( ) => codec ) ;
430+ client . AddHandler ( "text/json" , ( ) => codec ) ;
431+ client . AddHandler ( "text/x-json" , ( ) => codec ) ;
432+ client . AddHandler ( "text/javascript" , ( ) => codec ) ;
433+ client . AddHandler ( "*+json" , ( ) => codec ) ;
434+ client . AddHandler ( "*" , ( ) => codec ) ;
425435 }
426436
427- client . AddHandler ( new XmlDeserializer ( ) , "application/xml" , "text/xml" , "*+xml" ) ;
437+ client . AddHandler ( "application/xml" , ( ) => new XmlDeserializer ( ) ) ;
438+ client . AddHandler ( "text/xml" , ( ) => new XmlDeserializer ( ) ) ;
439+ client . AddHandler ( "*+xml" , ( ) => new XmlDeserializer ( ) ) ;
428440
429441 client . Timeout = configuration . Timeout ;
430442
@@ -434,7 +446,7 @@ private async Task<ApiResponse<T>> Exec<T>(RestRequest req, IReadableConfigurati
434446 }
435447
436448 InterceptRequest ( req ) ;
437- var response = await client . ExecuteTaskAsync < T > ( req ) ;
449+ var response = await client . ExecuteAsync < T > ( req ) ;
438450 InterceptResponse ( req , response ) ;
439451
440452 var result = toApiResponse ( response ) ;
0 commit comments