GH-3675: Restore nativeHeaders for WebSocketInChA
Fixes https://github.com/spring-projects/spring-integration/issues/3675 The `WebSocketInboundChannelAdapter` removes a `SimpMessageHeaderAccessor.NATIVE_HEADERS` from headers used to create an outbound message. Turns out not all native headers are mapped by the `StompHeaderAccessor` to the top-level header entries. **Cherry-pick to `5.4.x` & `5.3.x`**
This commit is contained in:
committed by
Gary Russell
parent
3dabf7aec1
commit
fb14976f61
@@ -46,7 +46,6 @@ import org.springframework.web.socket.client.standard.StandardWebSocketClient;
|
||||
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
|
||||
import org.springframework.web.socket.messaging.SubProtocolHandler;
|
||||
import org.springframework.web.socket.sockjs.client.SockJsClient;
|
||||
import org.springframework.web.socket.sockjs.client.Transport;
|
||||
import org.springframework.web.socket.sockjs.client.WebSocketTransport;
|
||||
|
||||
/**
|
||||
@@ -101,7 +100,7 @@ public class WebSocketOutboundMessageHandlerTests {
|
||||
|
||||
@Bean
|
||||
public WebSocketClient webSocketClient() {
|
||||
return new SockJsClient(Collections.<Transport>singletonList(new WebSocketTransport(new StandardWebSocketClient())));
|
||||
return new SockJsClient(Collections.singletonList(new WebSocketTransport(new StandardWebSocketClient())));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -134,6 +134,7 @@ public class WebSocketServerTests {
|
||||
assertThat(received).isNotNull();
|
||||
StompHeaderAccessor stompHeaderAccessor = StompHeaderAccessor.wrap(received);
|
||||
assertThat(stompHeaderAccessor.getMessageType()).isEqualTo(StompCommand.MESSAGE.getMessageType());
|
||||
assertThat(stompHeaderAccessor.getNativeHeader(StompHeaderAccessor.STOMP_MESSAGE_ID_HEADER)).isNotNull();
|
||||
|
||||
Object receivedPayload = received.getPayload();
|
||||
assertThat(receivedPayload).isInstanceOf(String.class);
|
||||
|
||||
Reference in New Issue
Block a user