From: Kai Moritz Date: Thu, 21 Nov 2019 13:47:37 +0000 (+0100) Subject: WIP: WebClient X-Git-Tag: wip-webclient~25 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=54dcb2aa2eaef71f9eb2971e1e8db7d333366239;p=facebook-errors WIP: WebClient --- diff --git a/src/main/java/de/juplo/facebook/errors/GraphApiException.java b/src/main/java/de/juplo/facebook/errors/GraphApiException.java index 5ec30fa..b82a05b 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiException.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiException.java @@ -50,12 +50,12 @@ public class GraphApiException extends RuntimeException public static GraphApiException create(ClientResponse response) { return - response.body((ReactiveHttpInputMessage message, Context context) -> - { - DataBuffer buffer = message.getBody().blockFirst(); - InputStream is = message.getBody().blockFirst().asInputStream(); - return create(response.statusCode(), message.getHeaders(), is); - }); + response + .body((ReactiveHttpInputMessage message, Context context) -> + message + .getBody() + .map(buffer -> buffer.asInputStream())) + .flatMap(is -> create(response.statusCode(), message.getHeaders(), is)); } public static GraphApiException create(