When my system send a http request using okhttp3 the follow issue occurs: 413 Request Entity Too Large
I would to know how I set a maximum size in okhttp3 request or if there is another solution for this issue.
public static String post(String url, String json) throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.readTimeout(1, TimeUnit.MINUTES)
.build();
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.header("Authorization", authKey)
.url(url)
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
if(response.code() != 200) {
return "request error";
}
return response.body().string();
}
}