Skip to content

Commit

Permalink
Correct methods name (#2243)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtaile2712 authored Jul 30, 2024
1 parent fef25a5 commit aa43b68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/versioned_docs/version-v111/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var timeline = await client.GetAsync<HomeTimeline>(request, cancellationToken);
Both snippets above use the `GetAsync` extension, which is a wrapper about `ExecuteGetAsync`, which, in turn, is a wrapper around `ExecuteAsync`.
All `ExecuteAsync` overloads and return the `RestResponse` or `RestResponse<T>`.

The most important difference is that async methods named after HTTP methods (like `GetAsync` or `PostAsync`) return `Task<T>` instead of `Task<RestResponse<T>>`. It means that you won't get an error response if the request fails as those methods throw an exception for unsuccessful HTTP calls. For keeping the API consistent, non-generic functions like `GetAsync` or `PostAsync` also throw an exception if the request fails, although they return the `Task<RestResponse>`.
The most important difference is that async methods named after HTTP methods (like `GetAsync<T>` or `PostAsync<T>`) return `Task<T>` instead of `Task<RestResponse<T>>`. It means that you won't get an error response if the request fails as those methods throw an exception for unsuccessful HTTP calls. For keeping the API consistent, non-generic functions like `GetAsync` or `PostAsync` also throw an exception if the request fails, although they return the `Task<RestResponse>`.

Read [here](advanced/error-handling.md) about how RestSharp handles exceptions.

Expand Down

0 comments on commit aa43b68

Please sign in to comment.