Skip to content

Commit 506524f

Browse files
author
Stephane Landelle
committed
BodyDeferringAsyncHandler.onComplete should build response when no part, close AsyncHttpClient#113
1 parent 33669cb commit 506524f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api/src/main/java/org/asynchttpclient/BodyDeferringAsyncHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class BodyDeferringAsyncHandler implements AsyncHandler<Response> {
7979

8080
private final OutputStream output;
8181

82-
private volatile boolean responseSet;
82+
private boolean responseSet;
8383

8484
private volatile Response response;
8585

@@ -150,6 +150,12 @@ protected void closeOut() throws IOException {
150150
}
151151

152152
public Response onCompleted() throws IOException {
153+
154+
if (!responseSet) {
155+
response = responseBuilder.build();
156+
responseSet = true;
157+
}
158+
153159
// Counting down to handle error cases too.
154160
// In "normal" cases, latch is already at 0 here
155161
// But in other cases, for example when because of some error

0 commit comments

Comments
 (0)