Skip to content

Commit

Permalink
Merge pull request #35990 from geoand/#35966
Browse files Browse the repository at this point in the history
Don't ignore empty SSE events in client
  • Loading branch information
geoand committed Sep 18, 2023
2 parents ffdb63e + a3ba466 commit 9d43b47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,12 @@ public void testParser() {
}

private void testParser(String event, String data, String comment, String lastId, String name, long reconnectDelay) {
if (data != null) {
testParser(Collections.singletonList(event), Collections.singletonList(new InboundSseEventImpl(null, null)
.setData(data)
.setComment(comment)
.setId(lastId)
.setName(name)
.setReconnectDelay(reconnectDelay)));
} else if (comment != null) {
testParser(Collections.singletonList(event), Collections.singletonList(new InboundSseEventImpl(null, null)
.setData(null)
.setComment(comment)
.setId(lastId)
.setName(name)
.setReconnectDelay(reconnectDelay)));
} else {
testParser(Collections.singletonList(event), Collections.emptyList());
}
testParser(Collections.singletonList(event), Collections.singletonList(new InboundSseEventImpl(null, null)
.setData(data)
.setComment(comment)
.setId(lastId)
.setName(name)
.setReconnectDelay(reconnectDelay)));
}

private void testParser(List<String> events, List<InboundSseEvent> expectedEvents) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ private void parseEvent() {
}

private void dispatchEvent() {
// ignore empty events
if (dataBuffer.length() == 0 && commentBuffer.length() == 0)
return;
WebTargetImpl webTarget = sseEventSource.getWebTarget();
InboundSseEventImpl event;
// tests don't set a web target, and we don't want them to end up starting vertx just to test parsing
Expand Down

0 comments on commit 9d43b47

Please sign in to comment.