Is there any possibility to compare a Call
URL with a String
in Retrofit 2
?
For example we can take this baseUrl
:
https://www.google.com
And this Call
:
public interface ExampleService {
@GET("dummy/{examplePartialUrl}/")
Call<JsonObject> exampleList(@Path("examplePartialUrl") String examplePartialUrl;
}
with this request:
Call<JsonObject> mCall = dummyService.exampleList("partialDummy")
There's a way to obtain https://www.google.com/dummy/partialDummy
or also dummy/partialDummy
before getting the response from the call?
Personally I found another way to accomplish this by using retrofit 2 and RxJava
First you need to create an OkHttpClient object
after creating this object, the next step is just use it in retrofit builder
one of the attributes you can assign to Retrofit builder is the client, set the client to the client from the first function.
After running this code you could search for OkHttp tag in the logcat and you will see the requests and responses you made.
Assuming you're using OkHttp alongside Retrofit, you could do something like:
dummyService.exampleList("partialDummy").request().url().toString()
which according to the OkHttp docs should print:
https://www.google.com/dummy/partialDummy