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
(cherry picked from commit a3ba466)
  • Loading branch information
geoand authored and aloubyansky committed Oct 31, 2023
1 parent 154fe51 commit 8449c98
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 8449c98

Please sign in to comment.