You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'd like to reuse RestClient for different requests, from different threads. I'd also like to have different serialisers per request (mainly for logging of url along with exact response). I can easily have one of these, but currently not both at the same time, since the serialiser is set on the client, not on the request.
Describe the solution you'd like
I would like to do
Describe alternatives you've considered
There is #1791 (comment) which created a whole dictionary of clients to workaround the issue. I would end up with too many clients to use this workaround – preferably I'd have just one client for all requests.
Very typically, you want these to be the same for calls to the same host but not for calls to different ones. For this reason, an HttpClient instance per host being called is actually a very good practice. Unless you're calling thousands of different hosts, you don't need to worry about the infamous socket exhaustion problem here. (And even if you were using a singleton, the underlying network stack would need to open a different socket per host anyway.)
The only valid reason to reuse the client for is the sake of reusing socket connections, which makes no sense when the client is used to call different base URLs. It is also very unlikely that a single base address has an API endpoints so wildly different they require different serialiser per endpoint.
Is your feature request related to a problem? Please describe.
I'd like to reuse RestClient for different requests, from different threads. I'd also like to have different serialisers per request (mainly for logging of url along with exact response). I can easily have one of these, but currently not both at the same time, since the serialiser is set on the client, not on the request.
Describe the solution you'd like
I would like to do
(or
var req = new RestRequest(url, serializer: …);
) instead of having toDescribe alternatives you've considered
There is #1791 (comment) which created a whole dictionary of clients to workaround the issue. I would end up with too many clients to use this workaround – preferably I'd have just one client for all requests.
Additional context
https://restsharp.dev/v107/#restclient-lifecycle says we should reuse, as with HttpClient :)
The text was updated successfully, but these errors were encountered: