0
OkHttp를 사용하여 Google에 일괄 요청을 보내려고했지만 응답에서 항상 오류 500 및 알 수없는 오류가 발생했습니다.Google에 일괄 요청을 보내지 않았다.
이것은 내 코드이며 토큰은 GoogleAuthUtil에서 가져옵니다.
MultipartBuilder multipartBuilder = new MultipartBuilder();
MediaType http = MediaType.parse("application/http");
MediaType mixed = MediaType.parse("multipart/mixed");
multipartBuilder.addPart(RequestBody.create(http, "GET https://www.googleapis.com/gmail/v1/users/me/messages"));
multipartBuilder.type(mixed);
Request request = new Request.Builder()
.url("https://www.googleapis.com/batch")
.header("Authorization", " Bearer " + token)
.post(multipartBuilder.build())
.build();
try{
Response response = client.newCall(request).execute();
String res = response.body().string();
}
catch (IOException e){
e.printStackTrace();
}