-
Notifications
You must be signed in to change notification settings - Fork 192
Set Proxy and Timeouts #42
Comments
You know, I don't think there is a way. I'd be happy to add one, probably via a constructor that just lets you pass your own httpclient (not sure who would be responsible for disposing though), but I'm travelling this week so I can't do it quickly. I'd be happy to accept a PR or do it when I'm home again. |
I've added a constructor that takes an HttpClient, @robertmircea . https://github.com/PlayFab/consuldotnet/blob/develop/Consul/Client.cs#L417-L444 Use it with something like:
The |
Thanks for making this available. I favor the pattern where external dependencies are not managed from lifecycle point of view by the components using them. So, in our case, if I pass in ConsulClient's class constructor a HttpClient object, I would like to be responsible for the moment when is the right time to dispose it. This prevents of unwanted and unexpected side effects. I would appreciate, if you could remove the disposal step from library. |
Fair enough, will do. I've also removed any mutation of the passed HttpClient. You are responsible for creating one that accepts The pattern now looks like:
I'll merge this in and release a build. |
And released: https://www.nuget.org/packages/Consul/0.6.3.4 Have fun! |
What is the best method to set proxy settings and timeouts for the underlying httpclient used by consuldotnet?
The text was updated successfully, but these errors were encountered: