Skip to content

Fix HttpHeaders and WebSocketHttpHeaders interop issues #35792

@filiphr

Description

@filiphr

We are using WebSocketHttpHeaders for some of our web socket testing. I have noticed that using them does not work properly with the WebSocketStompClient

we do

WebSocketHttpHeaders headers= new WebSocketHttpHeaders();
        headers.add("Authorization", "Basic " + base64Credentials);
        StompSession stompSession = this.stompClient.connectAsync("ws://localhost:{port}/flowable-engage/engage-api/ws/conversation", headers, handler, this.serverPort)
            .get(10, TimeUnit.SECONDS);

This eventually calls the WebSocketClient#execute. In our test we use the SockJsClient, that one eventually calls InfoReceiver#executeInfoRequest, which does

HttpHeaders infoRequestHeaders = new HttpHeaders();
if (headers != null) {
    infoRequestHeaders.putAll(headers);
}

The problem is that the headers are WebSocketHttpHeaders, so doing putAll uses the field from the HttpHeaders and not from the WebSocketHttpHeaders

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions