Open ikhoon opened 3 years ago
Additionally, how do you think similar feature,
Additionally, how about adding HttpRequest.ofJson
?HttpRequest.ofJson
also?
+1 to having HttpRequest.ofJson()
as well.
It would also be nice to have APIs that automatically convert a response into an object.
UnsupportedMediaTypeException
could complete the returned future for unknown media types.JsonProcessingException
could complete the returned future
when failing to decode a JSON in response body into an object.UnexpectedHttpStatusException
could complete the returned future.interface HttpResponse {
<T> CompletableFuture<T> aggregateAs(Class<? extends T> clazz);
<T> CompletableFuture<T> aggregateAs(HttpStatus expectedStatus, Class<? extends T> clazz);
<T> CompletableFuture<T> aggregateAs(HttpStatus expectedStatus, Class<? extends T> clazz, EventExecutor executor);
}
I'm interested in this!
Thanks! It's all yours.
JSON is the dominant exchange format for REST API. However, Armeria's
WebClient
does not provide any JSON-specific APIs. I believe it should be useful additions if we provide: