From 54dcb2aa2eaef71f9eb2971e1e8db7d333366239 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 21 Nov 2019 14:47:37 +0100 Subject: [PATCH] WIP: WebClient --- .../de/juplo/facebook/errors/GraphApiException.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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( -- 2.20.1