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:
Artem Bilan
2021-11-15 13:10:25 -05:00
committed by Gary Russell
parent 3dabf7aec1
commit fb14976f61
3 changed files with 4 additions and 3 deletions

View File

@@ -63,6 +63,8 @@ import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolHandler;
/**
* The {@link MessageProducerSupport} for inbound WebSocket messages.
*
* @author Artem Bilan
*
* @since 4.1
@@ -356,7 +358,6 @@ public class WebSocketInboundChannelAdapter extends MessageProducerSupport
}
private void produceMessage(Message<?> message, SimpMessageHeaderAccessor headerAccessor) {
headerAccessor.removeHeader(SimpMessageHeaderAccessor.NATIVE_HEADERS);
Object payload = this.messageConverter.fromMessage(message, this.payloadType.get());
Assert.state(payload != null,
() -> "The message converter '" + this.messageConverter +