Skip to content

Setting headers for SSE annotated Multi resources is ignoring headers #44902

@dastrobu

Description

@dastrobu

Describe the bug

Setting response headers as shown below does not work when the resource is annotated with @Produces(MediaType.SERVER_SENT_EVENTS) or @RestStreamElementType(MediaType.APPLICATION_JSON).

        @POST
        @Path("sse-multi")
        @Produces(MediaType.SERVER_SENT_EVENTS)
        public Multi<String> sseMulti() {
            return RestMulti.fromMultiData(Multi.createFrom().items("hello", "world")).header("Foo", "Bar").build();
        }

See also #44898 (comment)

Expected behavior

headers are set as in

        @POST
        @Path("multi")
        public Multi<String> multi() {
            return RestMulti.fromMultiData(Multi.createFrom().items("hello", "world")).header("Foo", "Bar").build();
        }

Actual behavior

header is ignored

How to Reproduce?

I will provide a draft PR with a unit test.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions