/** * Now that we've buffered the entire request body, update the request headers and the body * itself. This happens late to enable HttpURLConnection users to complete the socket connection * before sending request body bytes. */ @Override public Request prepareToSendRequest(Request request) throws IOException { if (request.header("Content-Length") != null) return request; outputStream().close(); contentLength = buffer.size(); return request.newBuilder() .removeHeader("Transfer-Encoding") .header("Content-Length", Long.toString(buffer.size())) .build(); }
/** * Now that we've buffered the entire request body, update the request headers and the body * itself. This happens late to enable HttpURLConnection users to complete the socket connection * before sending request body bytes. */ @Override public Request prepareToSendRequest(Request request) throws IOException { if (request.header("Content-Length") != null) return request; outputStream().close(); contentLength = buffer.size(); return request.newBuilder() .removeHeader("Transfer-Encoding") .header("Content-Length", Long.toString(buffer.size())) .build(); }
/** * Now that we've buffered the entire request body, update the request headers and the body * itself. This happens late to enable HttpURLConnection users to complete the socket connection * before sending request body bytes. */ @Override public Request prepareToSendRequest(Request request) throws IOException { if (request.header("Content-Length") != null) return request; outputStream().close(); contentLength = buffer.size(); return request.newBuilder() .removeHeader("Transfer-Encoding") .header("Content-Length", Long.toString(buffer.size())) .build(); }
/** * Now that we've buffered the entire request body, update the request headers and the body * itself. This happens late to enable HttpURLConnection users to complete the socket connection * before sending request body bytes. */ @Override public Request prepareToSendRequest(Request request) throws IOException { if (request.header("Content-Length") != null) return request; outputStream().close(); contentLength = buffer.size(); return request.newBuilder() .removeHeader("Transfer-Encoding") .header("Content-Length", Long.toString(buffer.size())) .build(); }