I have a secure http connection to my GraphQL Endpoint using HttpURLConnection
. How can i use HttpURLConnection
with ApolloClient, instead of okHttpClient
?
Is there any way to convert an Object of HttpURLConnection
to okHttpClient
? Or How do i use my HttpURLConnection with httpEngine of ApolloClient ?
I
val apolloClient = ApolloClient.Builder()
.serverUrl("http://localhost:4000")
.build()
I worked around this by iterating through HttpUrlConnection request/header parametres and setting it in the builder
ApolloClient.Builder builder = ApolloClient.builder().serverUrl(graphQlURL);
for (Map.Entry<String, List<String>> entries : httpURLConnection.getRequestProperties().entrySet()) {
String values = "";
for (String value : entries.getValue()) {
values += value + ",";
}
builder.addHttpHeader(entries.getKey(),values);
Log.d("Request", entries.getKey() + " - " + values );
}
ApolloClient apolloClient = builder.build();