diff --git a/docs/versioned_docs/version-v111/advanced/configuration.md b/docs/versioned_docs/version-v111/advanced/configuration.md index 3c5341276..6fbfaed33 100644 --- a/docs/versioned_docs/version-v111/advanced/configuration.md +++ b/docs/versioned_docs/version-v111/advanced/configuration.md @@ -28,7 +28,7 @@ Constructor parameters are: | options | Client options | Yes | | configureDefaultHeaders | Function to configure headers. Allows to configure default headers for `HttpClient`. Most of the time you'd prefer using `client.AddDefaultHeader` instead. | No | | configureSerialization | Function to configure client serializers with non-default options or to use a different serializer ([learn more](serialization.md)) | No | -| useClientFactory | Instructs the client to use `SimpleFactory` ([learn more](../usage/basics#simple-factory)) to get an `HttpClient` instance | No | +| useClientFactory | Instructs the client to use `SimpleFactory` ([learn more](../usage/client#simple-factory)) to get an `HttpClient` instance | No | Here's an example of how to create a client using client options: @@ -227,4 +227,4 @@ Client options apply to all requests made by the client. Sometimes, you want to | `AdvancedResponseWriter` | Allows custom handling of the response. The function gets an instance of `HttpResponseMessage` and an instance of `RestRequest`. It must return an instance of `RestResponse`, so it effectively overrides RestSharp default functionality for creating responses. | | `Interceptors` | Allows adding interceptors to the request. Both client-level and request-level interceptors will be called. | -The table below contains all configuration properties of `RestRequest`. To learn more about adding request parameters, check the [usage page](../usage/basics#create-a-request) section about creating requests with parameters. +The table below contains all configuration properties of `RestRequest`. To learn more about adding request parameters, check the [usage page](../usage/request.md) section about creating requests with parameters. diff --git a/docs/versioned_docs/version-v111/intro.md b/docs/versioned_docs/version-v111/intro.md index a63d4223e..1aa03999c 100644 --- a/docs/versioned_docs/version-v111/intro.md +++ b/docs/versioned_docs/version-v111/intro.md @@ -74,7 +74,7 @@ var client = new RestClient(options); var timeline = await client.GetJsonAsync("statuses/home_timeline.json", cancellationToken); ``` -Read [here](usage/basics#json-requests) about making JSON calls without preparing a request object. +Read [here](usage/execute#json-requests) about making JSON calls without preparing a request object. ### Content type diff --git a/docs/versioned_docs/version-v111/usage/basics.md b/docs/versioned_docs/version-v111/usage/basics.md index 0c0005462..33efd7a05 100644 --- a/docs/versioned_docs/version-v111/usage/basics.md +++ b/docs/versioned_docs/version-v111/usage/basics.md @@ -126,20 +126,6 @@ First, there's `DownloadDataAsync`, which returns `Task`. This function allows you to open a stream reader and asynchronously stream large responses to memory or disk. - -## Reusing HttpClient - -RestSharp uses `HttpClient` internally to make HTTP requests. It's possible to reuse the same `HttpClient` instance for multiple `RestClient` instances. This is useful when you want to share the same connection pool between multiple `RestClient` instances. - -One way of doing it is to use `RestClient` constructors that accept an instance of `HttpClient` or `HttpMessageHandler` as an argument. Note that in that case not all the options provided via `RestClientOptions` will be used. Here is the list of options that will work: - -- `BaseAddress` will be used to set the base address of the `HttpClient` instance if base address is not set there already. -- `MaxTimeout` -- `UserAgent` will be added to the `RestClient.DefaultParameters` list as a HTTP header. This will be added to each request made by the `RestClient`, and the `HttpClient` instance will not be modified. This is to allow the `HttpClient` instance to be reused for scenarios where different `User-Agent` headers are required. -- `Expect100Continue` - -Another option is to use a simple HTTP client factory as described [above](#simple-factory). - ## Blazor support Inside a Blazor webassembly app, you can make requests to external API endpoints. Microsoft examples show how to do it with `HttpClient`, and it's also possible to use RestSharp for the same purpose. diff --git a/docs/versioned_docs/version-v111/usage/client.md b/docs/versioned_docs/version-v111/usage/client.md index a33423e3f..2865e5791 100644 --- a/docs/versioned_docs/version-v111/usage/client.md +++ b/docs/versioned_docs/version-v111/usage/client.md @@ -58,3 +58,17 @@ You need to set the `useClientFactory` parameter to `true` in the `RestClient` c ```csharp var client = new RestClient("https://api.twitter.com/2", true); ``` + +## Reusing HttpClient + +RestSharp uses `HttpClient` internally to make HTTP requests. It's possible to reuse the same `HttpClient` instance for multiple `RestClient` instances. This is useful when you want to share the same connection pool between multiple `RestClient` instances. + +One way of doing it is to use `RestClient` constructors that accept an instance of `HttpClient` or `HttpMessageHandler` as an argument. Note that in that case not all the options provided via `RestClientOptions` will be used. Here is the list of options that will work: + +- `BaseAddress` is be used to set the base address of the `HttpClient` instance if base address is not set there already. +- `MaxTimeout` is used to cancel the call using the cancellation token source, so +- `UserAgent` will be added to the `RestClient.DefaultParameters` list as a HTTP header. This will be added to each request made by the `RestClient`, and the `HttpClient` instance will not be modified. This is to allow the `HttpClient` instance to be reused for scenarios where different `User-Agent` headers are required. +- `Expect100Continue` + +Another option is to use a simple HTTP client factory as described [above](#simple-factory). +