Skip to content

Commit e9449e0

Browse files
authored
Web Client: use request promise bound to the creating context (#2703)
This guarantees that request promise callbacks will always be invoked on the right context. Signed-off-by: Thomas Segismont <[email protected]>
1 parent e929e14 commit e9449e0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vertx-web-client/src/main/java/io/vertx/ext/web/client/impl/HttpContext.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import io.vertx.core.http.HttpHeaders;
2424
import io.vertx.core.http.RequestOptions;
2525
import io.vertx.core.http.impl.HttpClientInternal;
26+
import io.vertx.core.impl.ContextInternal;
2627
import io.vertx.core.json.Json;
2728
import io.vertx.core.json.JsonObject;
2829
import io.vertx.core.streams.Pipe;
@@ -45,7 +46,7 @@ public class HttpContext<T> {
4546
private final HttpClientInternal client;
4647
private final WebClientOptions options;
4748
private final List<Handler<HttpContext<?>>> interceptors;
48-
private Context context;
49+
private ContextInternal context;
4950
private HttpRequestImpl<T> request;
5051
private Object body;
5152
private String contentType;
@@ -424,7 +425,7 @@ private void handlePrepareRequest() {
424425
}
425426

426427
private void handleCreateRequest() {
427-
requestPromise = Promise.promise();
428+
requestPromise = context.promise();
428429
if (body != null || "application/json".equals(contentType)) {
429430
if (body instanceof MultipartForm) {
430431
MultipartFormUpload multipartForm;

0 commit comments

Comments
 (0)