On 30 November 2015 at 21:43, Michael Osipov <micha...@apache.org> wrote: > Am 2015-11-30 um 19:53 schrieb Gary Gregory: >> >> I mean: >> >> Index: src/main/java/org/apache/hc/core5/http/HttpMessage.java >> =================================================================== >> --- src/main/java/org/apache/hc/core5/http/HttpMessage.java (revision >> 1717301) >> +++ src/main/java/org/apache/hc/core5/http/HttpMessage.java (working copy) >> @@ -55,7 +55,7 @@ >> * @param name the name of the header. >> * @param value the value of the header. >> */ >> - void addHeader(String name, String value); >> + void addHeader(String name, Object value); >> >> /** >> * Overwrites the first header with the same name. The new header >> will >> be appended to >> @@ -72,7 +72,7 @@ >> * @param name the name of the header. >> * @param value the value of the header. >> */ >> - void setHeader(String name, String value); >> + void setHeader(String name, Object value); >> >> /** >> * Overwrites all the headers in the message. >> Index: >> src/main/java/org/apache/hc/core5/http/message/AbstractHttpMessage.java >> =================================================================== >> --- >> src/main/java/org/apache/hc/core5/http/message/AbstractHttpMessage.java >> (revision >> 1717301) >> +++ >> src/main/java/org/apache/hc/core5/http/message/AbstractHttpMessage.java >> (working >> copy) >> @@ -43,13 +43,13 @@ >> private HttpEntity entity; >> >> @Override >> - public void addHeader(final String name, final String value) { >> + public void addHeader(final String name, final Object value) { >> Args.notNull(name, "Header name"); >> addHeader(new BasicHeader(name, value)); >> } >> >> @Override >> - public void setHeader(final String name, final String value) { >> + public void setHeader(final String name, final Object value) { >> Args.notNull(name, "Header name"); >> setHeader(new BasicHeader(name, value)); >> } >> Index: src/main/java/org/apache/hc/core5/http/message/BasicHeader.java >> =================================================================== >> --- src/main/java/org/apache/hc/core5/http/message/BasicHeader.java >> (revision >> 1717301) >> +++ src/main/java/org/apache/hc/core5/http/message/BasicHeader.java >> (working >> copy) >> @@ -28,6 +28,7 @@ >> package org.apache.hc.core5.http.message; >> >> import java.io.Serializable; >> +import java.util.Objects; >> >> import org.apache.hc.core5.annotation.Immutable; >> import org.apache.hc.core5.http.Header; >> @@ -55,10 +56,10 @@ >> * @param name the header name >> * @param value the header value >> */ >> - public BasicHeader(final String name, final String value) { >> + public BasicHeader(final String name, final Object value) { >> super(); >> this.name = Args.notNull(name, "Name"); >> - this.value = value; >> + this.value = Objects.toString(value, null); >> } >> >> @Override >> >> Thoughts? > > > Gary, > > what benefit do you expect from this patch? If I would read the new code, I > would expect some magic which would auto-convert compatible types to its > HTTP header counterparts. E.g., numbers, dates, lists, etc. > Which you obviously don't. If you don't plan to add that, you should at > least extend the Javadoc and say you relief the caller from the #toString > burden. No more, no less.
+1 > Michael > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org > For additional commands, e-mail: dev-h...@hc.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org