Closed arun0009 closed 3 years ago
Is there an overlap with #195 here ? How would an upgrade to okhttp4 impact this ? It seems they have gone to great length to stay compatible but there are some differences. https://square.github.io/okhttp/upgrading_to_okhttp_4/
It's not an overlap, with current implementation irrelevant of OkHttp version, I can't configure OkHttpClient with for e.g. proxy etc.
@anuraaga - can you please review?
Giving this PR a nudge - unless there is a different way of supporting proxied reporting that doesn't use environment level setup. Thanks.
Making customizations to the OkHttp client builder should already be possible and an example is given in the JavaDoc already. For the example of configuring a proxy, here's some code that should work:
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.company.com", 8099));
OkHttpSender.Builder okHttpSenderBuilder = OkHttpSender.newBuilder();
okHttpSenderBuilder.clientBuilder().proxy(proxy);
OkHttpSender sender = okHttpSenderBuilder.build();
We test such customizations work in this test. Am I missing something? It doesn't seem like we need new API for the use cases mentioned.
Allow passing custom OkHttpClient to OkHttpSender builder so we can configure a proxy, httpLoggingInterceptor, etc on OkHttpClient.