diff --git a/src/org/redkale/net/http/HttpSimpleRequest.java b/src/org/redkale/net/http/HttpSimpleRequest.java index ca3e472a9..bd3582d5c 100644 --- a/src/org/redkale/net/http/HttpSimpleRequest.java +++ b/src/org/redkale/net/http/HttpSimpleRequest.java @@ -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;