Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerSentEvent should implement equals() and hashCode() #33606

Closed
jelmerk opened this issue Sep 29, 2024 · 0 comments
Closed

ServerSentEvent should implement equals() and hashCode() #33606

jelmerk opened this issue Sep 29, 2024 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@jelmerk
Copy link

jelmerk commented Sep 29, 2024

ServerSentEvent is an immutable class but does not implement equals and hashCode.

So something like this does not work:

        StepVerifier.create(responseBodyFlux)
            .expectNext(ServerSentEvent.builder(ChatResponseMessage("And")).build())

And instead it forces you to write something like this:

        StepVerifier.create(responseBodyFlux)
            .consumeNextWith { event -> assertThat(event.data()?.text).isEqualTo("And") }

which is both inconvenient and unexpected.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 29, 2024
@bclozel bclozel added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Sep 29, 2024
@sbrannen sbrannen changed the title org.springframework.http.codec.ServerSentEvent should implement equals and hashcode ServerSentEvent should implement equals() and hashCode() Sep 29, 2024
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 30, 2024
@jhoeller jhoeller self-assigned this Sep 30, 2024
@jhoeller jhoeller added this to the 6.2.0-RC2 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants