Skip to content

Commit 99da52b

Browse files
author
Stephane Landelle
committed
BodyDeferringAsyncHandler.onComplete should build response when no part, close AsyncHttpClient#113
1 parent 5708fbe commit 99da52b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/com/ning/http/client/BodyDeferringAsyncHandler.java

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

8181
private final OutputStream output;
8282

83-
private volatile boolean responseSet;
83+
private boolean responseSet;
8484

8585
private volatile Response response;
8686

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

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

0 commit comments

Comments
 (0)