add default constructor for HttpRequestBody #609

0.8.0
yihua.huang 8 years ago
parent eb376fca74
commit f405e642c0

@ -29,11 +29,14 @@ public class HttpRequestBody implements Serializable {
public static final String MULTIPART = "multipart/form-data"; public static final String MULTIPART = "multipart/form-data";
} }
private final byte[] body; private byte[] body;
private final String contentType; private String contentType;
private final String encoding; private String encoding;
public HttpRequestBody() {
}
public HttpRequestBody(byte[] body, String contentType, String encoding) { public HttpRequestBody(byte[] body, String contentType, String encoding) {
this.body = body; this.body = body;
@ -49,6 +52,18 @@ public class HttpRequestBody implements Serializable {
return encoding; return encoding;
} }
public void setBody(byte[] body) {
this.body = body;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public static HttpRequestBody json(String json, String encoding) throws UnsupportedEncodingException { public static HttpRequestBody json(String json, String encoding) throws UnsupportedEncodingException {
return new HttpRequestBody(json.getBytes(encoding), ContentType.JSON, encoding); return new HttpRequestBody(json.getBytes(encoding), ContentType.JSON, encoding);
} }

Loading…
Cancel
Save