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

Resteasy Reactive duplicates headers when custom WriterInterceptor is present #27325

Closed
Postremus opened this issue Aug 17, 2022 · 3 comments · Fixed by #27406
Closed

Resteasy Reactive duplicates headers when custom WriterInterceptor is present #27325

Postremus opened this issue Aug 17, 2022 · 3 comments · Fixed by #27406
Assignees
Labels
area/resteasy-reactive kind/bug Something isn't working
Milestone

Comments

@Postremus
Copy link
Member

Describe the bug

After migrating my app to resteasy-reactive, I noticed that all response headers I set myself are being duplicated.
Headers set by quarkus, like content-length and content-type, are only present once in the response as expected

Essentially, whenever a custom writerinterceptor is present in the app, all custom response headers are duplicated. The interceptor does not even have to do anything.

This duplication did not happen with resteasy classic.

@Provider
public class CachePolicyHeaderProvider implements WriterInterceptor {

    @Override
    public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
        context.proceed();
    }
}
@Path("/hello")
public class GreetingResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public Response hello() {
        return Response.ok("123").lastModified(new Date()).header("etag", 0).build();
    }
}

Expected behavior

No headers are getting duplicated.

Actual behavior

image

How to Reproduce?

Reproducer:
Uploading etag-duplication.zip…

  1. mvn quarkus:dev
  2. go to http://localhost:8080/hello in a browser
  3. look at the servers response in the network view
  4. notice the response headers being duplicated

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.1889]

Output of java -version

openjdk version "18.0.2" 2022-07-19 OpenJDK Runtime Environment Temurin-18.0.2+9 (build 18.0.2+9) OpenJDK 64-Bit Server VM Temurin-18.0.2+9 (build 18.0.2+9, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\eclipse\tools\java\maven Java version: 18.0.2, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\18 Default locale: de_DE, platform encoding: UTF-8 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

@Postremus Postremus added the kind/bug Something isn't working label Aug 17, 2022
@quarkus-bot quarkus-bot bot added area/resteasy-reactive env/windows Impacts Windows machines labels Aug 17, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 17, 2022

/cc @FroMage, @geoand, @stuartwdouglas

@Postremus Postremus removed the env/windows Impacts Windows machines label Aug 17, 2022
@Postremus
Copy link
Member Author

FTR.
I can work around this bug by using a ContainerResponseFilter instead of a WriterInterceptor.

@geoand
Copy link
Contributor

geoand commented Aug 22, 2022

Thanks for reporting. #27406 takes care of it

geoand added a commit that referenced this issue Aug 22, 2022
Prevent duplicate HTTP headers when WriterInterceptor is used
@quarkus-bot quarkus-bot bot added this to the 2.13 - main milestone Aug 22, 2022
sheilamjones pushed a commit to sheilamjones/quarkus that referenced this issue Aug 22, 2022
@gsmet gsmet modified the milestones: 2.13 - main, 2.12.0.Final Aug 23, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 23, 2022
fercomunello pushed a commit to fercomunello/quarkus that referenced this issue Aug 31, 2022
@gsmet gsmet modified the milestones: 2.12.0.Final, 2.7.7.Final Jan 13, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 13, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 18, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/resteasy-reactive kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants