Comments (5)
One solution would be to use Apache Commons Collections Case Insensitive Map for storing headers. However that'd increase the dependency footprint. In any case here is a link:
from unirest-java.
This is a real problem for me too, different APIs return different cases for the headers. Something like that should work:
public class CaseInsensitiveMap extends HashMap<String, String> {
@Override
public String put(String key, String value) {
return super.put(key.toLowerCase(), value);
}
public String get(String key) {
return super.get(key.toLowerCase());
}
}
from unirest-java.
I think a cleaner solution is to use
Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
from unirest-java.
Yep gets the job done either way, headers are few enough so the perf difference between tree and hash map is irrelevant. Thanks for the fix.
from unirest-java.
I will push it to the Maven Central Repository soon in a new minor version.
from unirest-java.
Related Issues (20)
- bug query get with version 4 HOT 5
- Jackson MismatchedInputException for successful response with no body, after migrating to Unirest 4 HOT 2
- Automatic Retries not being used HOT 2
- MockClient: allow fine grained request verification or "un-expected" routes HOT 2
- Request cancellation (such as download cancellation) HOT 2
- Can't turn auto retries standard on HOT 10
- Incorrect Unirest version in README.md HOT 1
- Incorrect link to Interceptor file HOT 1
- Supported windows versions
- Configured HttpClient.Version ignored HOT 10
- MockClient: Mocking same route with different methods only invokes first registered/expected mocking response HOT 2
- multipart/form-data POST is missing content types HOT 6
- How to set read timeout duration HOT 4
- Can we add a response failure retry function? HOT 1
- Making header method to avoid redundant typing. HOT 2
- Make all HttpRequest.asObject work the same way HOT 2
- Strange behavior of response.getRequestSummary().getUrl() HOT 3
- Support the Partitioned flag on cookies HOT 1
- Is Unirest supported Server-Sent Events? HOT 2
- Requests are cancelled unexpectedly - connectTimeout limits request duration HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unirest-java.