This commit is contained in:
Redkale
2020-06-16 11:12:51 +08:00
parent ffd3b6daf6
commit 1eb1706166

View File

@@ -86,12 +86,42 @@ public class HttpSimpleRequest implements java.io.Serializable {
return this;
}
public HttpSimpleRequest header(String key, JsonConvert convert, Object value) {
if (value == null) return this;
if (this.headers == null) this.headers = new HashMap<>();
if (convert == null) convert = JsonConvert.root();
this.headers.put(key, convert.convertTo(value));
return this;
}
public HttpSimpleRequest header(String key, Object value) {
if (value == null) return this;
if (this.headers == null) this.headers = new HashMap<>();
this.headers.put(key, JsonConvert.root().convertTo(value));
return this;
}
public HttpSimpleRequest param(String key, String value) {
if (this.params == null) this.params = new HashMap<>();
this.params.put(key, value);
return this;
}
public HttpSimpleRequest param(String key, JsonConvert convert, Object value) {
if (value == null) return this;
if (this.params == null) this.params = new HashMap<>();
if (convert == null) convert = JsonConvert.root();
this.params.put(key, convert.convertTo(value));
return this;
}
public HttpSimpleRequest param(String key, Object value) {
if (value == null) return this;
if (this.params == null) this.params = new HashMap<>();
this.params.put(key, JsonConvert.root().convertTo(value));
return this;
}
public HttpSimpleRequest body(byte[] body) {
this.body = body;
return this;