HttpHeaders: need case insensitive get, set, and put #104
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
From yan...@google.com on May 05, 2012 11:07:17
External references, such as a standards document, or specification? http://javadoc.google-http-java-client.googlecode.com/hg/1.8.3-beta/com/google/api/client/http/HttpHeaders.html Java environments (e.g. Java 6, Android 2.3, App Engine, or All)? All Please describe the feature requested. Unlike JSON and URL parameters, HTTP headers are case insensitive. However, the get, put, and set methods from GenericData are case sensitive. For example, here is an issue reported from a user:
httpRequest.getHeaders().setAccept("/");
httpRequest.getHeaders().set("accept", "text/plain");
httpRequest.execute();
java.lang.IllegalArgumentException: multiple headers of the same name (headers are case insensitive): accept
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:750)
There are three ways I can think of that we could potentially deal with that:
Note that a case insensitive implementation for options 1 and 2 is generally slower than a case sensitive implementation because we have to iterate over all headers.
Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=104
The text was updated successfully, but these errors were encountered: