@@ -298,33 +298,33 @@ public async Task<RestResponse> ExecuteAsync(
298
298
You can also avoid setting the request method upfront and use one of the overloads:
299
299
300
300
``` csharp
301
- Task < RestResponse > ExecuteGetAsync
302
- Task < RestResponse > ExecutePostAsync
303
- Task < RestResponse > ExecutePutAsync
301
+ Task < RestResponse > ExecuteGetAsync ( RestRequest request , CancellationToken cancellationToken )
302
+ Task < RestResponse > ExecutePostAsync ( RestRequest request , CancellationToken cancellationToken )
303
+ Task < RestResponse > ExecutePutAsync ( RestRequest request , CancellationToken cancellationToken )
304
304
```
305
305
306
306
When using any of those methods, you will get the response content as string in ` response.Content ` .
307
307
308
308
RestSharp can deserialize the response for you. To use that feature, use one of the generic overloads:
309
309
310
310
``` csharp
311
- Task < RestResponse < T >> ExecuteAsync < T >
312
- Task < RestResponse < T >> ExecuteGetAsync < T >
313
- Task < RestResponse < T >> ExecutePostAsync < T >
314
- Task < RestResponse < T >> ExecutePutAsync < T >
311
+ Task < RestResponse < T >> ExecuteAsync <T >( RestRequest request , CancellationToken cancellationToken )
312
+ Task < RestResponse < T >> ExecuteGetAsync <T >( RestRequest request , CancellationToken cancellationToken )
313
+ Task < RestResponse < T >> ExecutePostAsync <T >( RestRequest request , CancellationToken cancellationToken )
314
+ Task < RestResponse < T >> ExecutePutAsync <T >( RestRequest request , CancellationToken cancellationToken )
315
315
```
316
316
317
317
All the overloads that return ` RestResponse ` or ` RestResponse<T> ` don't throw an exception if the server returns an error. Read more about it [ here] ( error-handling.md ) .
318
318
319
319
If you just need a deserialized response, you can use one of the extensions:
320
320
321
321
``` csharp
322
- Task < T > GetAsync < T >
323
- Task < T > PostAsync < T >
324
- Task < T > PutAsync < T >
325
- Task < T > HeadAsync < T >
326
- Task < T > PatchAsync < T >
327
- Task < T > DeleteAsync < T >
322
+ Task < T > GetAsync <T >( RestRequest request , CancellationToken cancellationToken )
323
+ Task < T > PostAsync <T >( RestRequest request , CancellationToken cancellationToken )
324
+ Task < T > PutAsync <T >( RestRequest request , CancellationToken cancellationToken )
325
+ Task < T > HeadAsync <T >( RestRequest request , CancellationToken cancellationToken )
326
+ Task < T > PatchAsync <T >( RestRequest request , CancellationToken cancellationToken )
327
+ Task < T > DeleteAsync <T >( RestRequest request , CancellationToken cancellationToken )
328
328
```
329
329
330
330
Those extensions will throw an exception if the server returns an error, as there's no other way to float the error back to the caller.
0 commit comments