Setting `MaxTimeout` in `RestClientOptions`

141 views
Skip to first unread message

Tall Navy Guy

unread,
Jul 11, 2024, 6:22:59 PM7/11/24
to RestSharp
Hi,
I have standardized code that I brought in from Postman that does

```C#
result = new RestClientOptions(baseUrl) { MaxTimeout = -1 }; 
```
But, with v111, the `MaxTimeout` property doesn't exist.  Yet, the docs at https://restsharp.dev/docs/advanced/configuration#client-options, which are labeled as being for v111, still list it.  

Where can I set this property?

Regards,


Brian Hart

Aldo Faisal Umam

unread,
Oct 6, 2025, 5:57:26 AM (11 days ago) Oct 6
to RestSharp

Hi Brian,

Since RestSharp v111, the MaxTimeout property was removed from RestClientOptions. If you want to configure timeouts now, you should either set it directly on the RestClient instance or on the RestRequest.Timeout. For example:

var options = new RestClientOptions(baseUrl) { ThrowOnAnyError = true }; var client = new RestClient(options) { // set timeout to 2 minutes Timeout = TimeSpan.FromMinutes(2) };

Or per request:

var request = new RestRequest("endpoint"); request.Timeout = TimeSpan.FromSeconds(30);

So in short:

  • MaxTimeout no longer exists in v111.

  • Use Timeout on RestClient or RestRequest instead.

  Docs: RestSharp config.
Extra reading: Kelas Public Speaking
Reply all
Reply to author
Forward
0 new messages