/** * Sets the response body. * * This method encodes the content to a byte array provided, and * sets the Content-Length header *if* the setContentLength * argument is true. * * @param content response body * @param setContentLength If true, Content-Length header is set, otherwise it is not set. * @return {@code this} */ public Builder body(byte[] content, boolean setContentLength) { this.body = content == null ? new byte[0] : content.clone(); if (setContentLength) { header(CONTENT_LENGTH, this.body.length); } return this; }