From 049097af29909f09b1fc1fb9c861f34d317bbc76 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 21 May 2020 19:58:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/http/HttpHelper.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt index af6dfa0b1..a65423e78 100644 --- a/app/src/main/java/io/legado/app/help/http/HttpHelper.kt +++ b/app/src/main/java/io/legado/app/help/http/HttpHelper.kt @@ -42,7 +42,7 @@ object HttpHelper { fun simpleGet(url: String, encode: String? = null): String? { NetworkUtils.getBaseUrl(url)?.let { baseUrl -> val response = getApiService(baseUrl, encode) - .get(url, mapOf()) + .get(url, mapOf(Pair(AppConst.UA_NAME, AppConst.userAgent))) .execute() return response.body() } @@ -52,7 +52,7 @@ object HttpHelper { suspend fun simpleGetAsync(url: String, encode: String? = null): String? { NetworkUtils.getBaseUrl(url)?.let { baseUrl -> val response = getApiService(baseUrl, encode) - .getAsync(url, mapOf()) + .getAsync(url, mapOf(Pair(AppConst.UA_NAME, AppConst.userAgent))) return response.body() } return null @@ -62,7 +62,7 @@ object HttpHelper { NetworkUtils.getBaseUrl(url)?.let { baseUrl -> return getByteRetrofit(baseUrl) .create(HttpGetApi::class.java) - .getMapByteAsync(url, mapOf(), mapOf()) + .getMapByteAsync(url, mapOf(), mapOf(Pair(AppConst.UA_NAME, AppConst.userAgent))) .body() } return null @@ -91,7 +91,6 @@ object HttpHelper { return Interceptor { chain -> val request = chain.request() .newBuilder() - .addHeader(AppConst.UA_NAME, AppConst.userAgent) .addHeader("Keep-Alive", "300") .addHeader("Connection", "Keep-Alive") .addHeader("Cache-Control", "no-cache")