Following is my RetrofitApi interface
const val USER_DETAIL = "private/{${Params.USER_NAME}}/details"
@GET(USER_DETAIL)
suspend fun getUsers(@Path(NetworkConstants.Params.USER_NAME) userName: String, @Query(NetworkConstants.Params.LANG) lang: String): Response<UserEntity?>
What I want is to know what is the URL after adding the query param and path to the respective url, like what is the final url before making API call.
Retrofit is making the final request url in its own library. How can i access that before making the request.
Context:
For caching purpose, I'm storing endpoints in db from the response interceptor. Now, before making another call, I want to check if that endpoint is already saved in my database or not. That's why I need to know what will be the final url.
Do I need to create my own Endpoint Builder Wrapper or does retrofit provides an easy way to access that final end point value?
So, I had to create wrapper class to build my end points, because retrofit doesn't expose url if you don't use retrofit CALL as return type.
I also created an issue/future request and Jake has responded: github.com/square/retrofit/issues/3628
Jake Wharton says:
Following is the calling code:
Now the EndPointBuilder class:
Here is my retrofit interface where url (without base url) is passed as an endpoint: