Skip to content

Leading whitespaces are removed while reading SSE response #27473

Closed
@yunjae2

Description

@yunjae2

Affects: 5.3.10.RELEASE and current main (30efa4d)


I'm making a SSE request to another server using WebClient w/ WebFlux, and the response from the WebClient always shows the results with leading whitespaces removed as well as trailing ones.
I think it is due to ServerSentEventHttpMessageReader::buildEvent trimming every line:

data.append(line.substring(5).trim()).append('\n');

Is there any reason that leading whitespaces must be removed from the SSE response data?
I wanted to use tabs at the start of each line to indent the text.
I've tried other clients like curl but they show responses with the leading whitespaces preserved.
Thanks in advance.

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