Don't overwrite okhttp ua if already set
If the request has its own UA set, don't overwrite it with the default RuneLite one. This has to be an interceptor and not a network interceptor so that it runs prior to the okhttp BridgeInteceptor, which is what sets the default okhttp ua.
This commit is contained in:
@@ -434,9 +434,15 @@ public class RuneLite
|
|||||||
{
|
{
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
||||||
.pingInterval(30, TimeUnit.SECONDS)
|
.pingInterval(30, TimeUnit.SECONDS)
|
||||||
.addNetworkInterceptor(chain ->
|
.addInterceptor(chain ->
|
||||||
{
|
{
|
||||||
Request userAgentRequest = chain.request()
|
Request request = chain.request();
|
||||||
|
if (request.header("User-Agent") != null)
|
||||||
|
{
|
||||||
|
return chain.proceed(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request userAgentRequest = request
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.header("User-Agent", USER_AGENT)
|
.header("User-Agent", USER_AGENT)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user