From b7f128900372ee033aaef79b11ab09ed65f5c0ce Mon Sep 17 00:00:00 2001 From: Edgar Asatryan Date: Sat, 16 Apr 2022 00:18:19 +0400 Subject: [PATCH] chore: Improve cache write. --- .../io/github/nstdio/http/ext/CachingBodySubscriber.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/io/github/nstdio/http/ext/CachingBodySubscriber.java b/src/main/java/io/github/nstdio/http/ext/CachingBodySubscriber.java index 6466b09..a880502 100644 --- a/src/main/java/io/github/nstdio/http/ext/CachingBodySubscriber.java +++ b/src/main/java/io/github/nstdio/http/ext/CachingBodySubscriber.java @@ -38,11 +38,7 @@ class CachingBodySubscriber implements BodySubscriber { public CompletionStage getBody() { return originalSub.getBody() .thenApplyAsync(t -> { - cachingSub.getBody() - .thenApplyAsync(body -> { - finisher.accept(body); - return body; - }); + cachingSub.getBody().thenAccept(finisher); return t; }); }