修复InputStreamBody下无法获取长度的问题

This commit is contained in:
jinyu committed 2015-12-14 19:43:56 +08:00
1 parent 9b67fbb1bb
commit d820d3d18b
2 files changed
+4 -7

No files matched your search

@@ -207,7 +207,7 @@ public class MediaApi extends MpApi {
String media_upload_uri = getRequestUri("media_upload_uri");
response = weixinExecutor.post(String.format(media_upload_uri,
token.getAccessToken(), mediaType.name()),
new FormBodyPart("media", new ByteArrayBody(content, mediaType
new FormBodyPart("media", new InputStreamBody(new ByteArrayInputStream(content), mediaType
.getContentType().getMimeType(),
fileName)));
JSONObject obj = response.getAsJson();