From 0f007d970ba45c8f67494c255a2be559194142cd Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Wed, 18 Oct 2017 12:27:11 +0800 Subject: [PATCH] =?UTF-8?q?#356=20=E4=BF=AE=E5=A4=8DQrCodeRequestExecutor?= =?UTF-8?q?=E7=B1=BBMimeType=E6=AF=94=E8=BE=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/util/http/QrCodeRequestExecutor.java | 3 ++- .../chanjar/weixin/mp/util/http/QrCodeRequestExecutor.java | 7 ++++--- .../mp/util/http/apache/ApacheQrCodeRequestExecutor.java | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/http/QrCodeRequestExecutor.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/http/QrCodeRequestExecutor.java index 1cbdf384..24d9e99b 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/http/QrCodeRequestExecutor.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/http/QrCodeRequestExecutor.java @@ -48,7 +48,8 @@ public class QrCodeRequestExecutor implements RequestExecutor 0 - && ContentType.APPLICATION_JSON.getMimeType().equals(contentTypeHeader[0].getValue())) { + && ContentType.APPLICATION_JSON.getMimeType() + .equals(ContentType.parse(contentTypeHeader[0].getValue()).getMimeType())) { String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); throw new WxErrorException(WxError.fromJson(responseContent)); } diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/http/QrCodeRequestExecutor.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/http/QrCodeRequestExecutor.java index 87c1920c..406eec01 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/http/QrCodeRequestExecutor.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/http/QrCodeRequestExecutor.java @@ -1,5 +1,7 @@ package me.chanjar.weixin.mp.util.http; +import me.chanjar.weixin.common.bean.result.WxError; +import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.util.http.RequestExecutor; import me.chanjar.weixin.common.util.http.RequestHttp; import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; @@ -21,7 +23,7 @@ public abstract class QrCodeRequestExecutor implements RequestExecutor create(RequestHttp requestHttp) { + public static RequestExecutor create(RequestHttp requestHttp) throws WxErrorException { switch (requestHttp.getRequestType()) { case APACHE_HTTP: return new ApacheQrCodeRequestExecutor(requestHttp); @@ -30,8 +32,7 @@ public abstract class QrCodeRequestExecutor implements RequestExecutor 0) { // 出错 - if (ContentType.TEXT_PLAIN.getMimeType().equals(contentTypeHeader[0].getValue())) { + if (ContentType.TEXT_PLAIN.getMimeType() + .equals(ContentType.parse(contentTypeHeader[0].getValue()).getMimeType())) { String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); throw new WxErrorException(WxError.fromJson(responseContent)); }