Move Authenticator to RestRequest
Opened this issue · 4 comments
Would it make more sense to have Authenticator on the RestRequest? I could then reuse clients across different usages of authentication.
The only thing that might make sense is to be able to override the authenticator for a single request and otherwise using the one in IRestClient
. What's the reason why you want to avoid multiple IRestClient
instances?
Basically this: http://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
Basically, I have a web server that's talking to a REST API. The web server passes creds on to the API. Managing the RestClient per scope is what I'm doing.
I guess I could make a custom client factory that's static basically then just make tons of RestClient instances.
Is that what you suggest?
I usually suggest a IRestClient per base URL, because that's the common usage scenario where you have a base URL and access only paths relative to this base URL. Your use case is quite uncommon, but it's valid. I should create a V4.1 for this.
Yeah, making a RestClient per base URL is what I was attempting to do.
Thanks!