Visitar URL original
Feature/fix-download-bug by shenliuming · Pull Request #3203 · binarywang/WxJava · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
增加微信返回contentTypeHeader的处理
  • Loading branch information
shenliuming
shenliuming committed Dec 30, 2023
commit e9d91d9911f52c3aa89d2a5655a6a75eaff9ee24
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public InputStream execute(String uri, String materialId, WxType wxType) throws
Request request = new Request.Builder().url(uri).get().post(requestBody).build();
Response response = client.newCall(request).execute();
String contentTypeHeader = response.header("Content-Type");
if ("text/plain".equals(contentTypeHeader) || "application/json; charset=utf-8".equals(contentTypeHeader)) {
if ("text/plain".equals(contentTypeHeader) || "application/json; charset=utf-8".equals(contentTypeHeader)
|| "application/json; encoding=utf-8".equals(contentTypeHeader)) {
String responseContent = response.body().string();
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP));
}
Expand Down