Skip to content

Commit

Permalink
Don't ignore empty SSE events in client
Browse files Browse the repository at this point in the history
RESTEasy Classic does not ignore them,
so let's keep the same behavior

Closes: quarkusio#35966
  • Loading branch information
geoand committed Sep 18, 2023
1 parent 6eb14c9 commit a3ba466
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 a3ba466

Please sign in to comment.