vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

WebClientBase request method does not populate headers from RequestOptions

Open marcinus opened this issue 4 years ago • 1 comments

Version

Validated it occurs 3.7.1, 4.0.0

Context

When using request RequestOptions

WebClient client = WebClient.create(vertx);
client.request(HttpMethod.GET, new RequestOptions().addHeader("authorization", "Bearer: 4gse4kgsel")); // + URL etc.

The request does not contain the headers from RequestOptions.

Do you have a reproducer?

See the code above.

  • Link to github project/gist

Steps to reproduce

See the code above

Extra

Windows 10, JDK1.8.0_202

marcinus avatar Jun 24 '20 13:06 marcinus

I'd like to add that the same behavior is observed while using the WebClientSession, due to the same bug.

var webClient = WebClient.create(vertx);
var webClientSession = WebClientSession.create(webClient)
    .addHeader("Authorization", "Bearer: 4gse4kgsel")

// No 'Authorization' header is being sent to server, just the 'User-Agent'
var request = webClientSession
    .getAbs("http://example.com/api/v1/someEndpoint")
    .send() 

Ultranium avatar Dec 08 '21 09:12 Ultranium