unirest-java v2.2.02 Release Notes
-
- ➕ Add a mapper function to transform a HttpResponse to a HttpResponse
java HttpResponse<Integer> response = Unirest.get("http://someplace/number") .asString() .map(Integer::valueOf);
- ➕ Add a few ways to map a error response into a different type than the original ```java ErrorThing error = Unirest.get("http://someplace") .asObject(Thing.class) .mapError(ErrorThing.class); // will be null if the request had been successful
Unirest.get("http://someplace") .asObject(Thing.class) .ifFailure(ErrorThing.class, f -> { // f is a HttpResponse // this function is not called if the request was succesful });
- ➕ Add a mapper function to transform a HttpResponse to a HttpResponse