String accessToken = wxTokenRedis.getToken(Constant.APPID, Constant.APPSECRET);
String url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=" + accessToken;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("type", "image");
body.add("media", new InputStreamResource(file.getInputStream()));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
return response.getBody();
这样封装的,请求报错{"errcode":41005,"errmsg":"media data missing hint: [QI7QEA091134-0] rid: 67c27007-0cc128ba-73b651f9"},明明有传media,但是为啥报错呢