Is there any way to do a `get` inside a ```return...
# ktor
p
Is there any way to do a
get
inside a
Copy code
return HttpClient(OkHttp) {
  //For instance if I want to update a refreshToken
}
d
It's definitely possible if you implement your own feature. Copy the code from
OAuthFeature
and modify it pass the client to the lambdas.
p
But the thing is how do I do a
get
in the lambda? If to do so I need an HttpClient, right?
d
You'll have the
HttpClient
when installing the feature.
p
How do I get reference of HttpClient? For instance if I have a service that via parameter receives an httpclient how do I call this? Service(httpClient:HttpClient) inside the feature?
j
I misread your question at first, but you will probably be looking for features. Usually you cannot use an object while configuring it, exactly like here.
Or you construct an http client that can handle authentication
and a second one to handle any other api calls
but yeah then you will have twice the resources in use
otherwise, perhaps have a look here: https://github.com/ktorio/ktor/issues/1967