eclipse-vertx / vert.x

Vert.x is a tool-kit for building reactive applications on the JVM
http://vertx.io
Other
14.26k stars 2.07k forks source link

HttpRequestImpl#connectTimeout does not support Fluent #5213

Closed bennygao closed 4 months ago

bennygao commented 4 months ago

Questions

In implements code of io.vertx.ext.web.client.impl.HttpRequestImpl#connectTimeout, it is supposed to return this, but it returns nullinstead, causing a NullPointerExceptionwhen setting other options of HttpRequest in a Fluent manner after connectTimeout.

    public HttpRequest<T> connectTimeout(long timeout) {
        this.connectTimeout = timeout;
        return null; // -> return this;
    }

For example:

webClient.requestAbs(method, absoluteURI)
        .connectTimeout(5000)
        .idleTimeout(60000) // NullPointerException here
    .putHeader("Content-Type", "application/json")
    .sendBuffer(buffer, asyncResult -> {
            ... ...
        });

Version

4.5.8

tsegismont commented 4 months ago

Nice catch, thank you @bennygao !

tsegismont commented 4 months ago

Fixed by https://github.com/vert-x3/vertx-web/commit/c96962a0c7a2f3fb9a33b2474fdacd9ee673261c