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

Changing Accept Header in PreMatching filter doesn't affect routing #38130

Closed
myroch opened this issue Jan 10, 2024 · 2 comments · Fixed by #38131
Closed

Changing Accept Header in PreMatching filter doesn't affect routing #38130

myroch opened this issue Jan 10, 2024 · 2 comments · Fixed by #38131
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@myroch
Copy link

myroch commented Jan 10, 2024

Describe the bug

After the switch to resteasy reactive my request filters don't work anymore.

Expected behavior

Accept Header set in the pre-matching request filter shall decide the routing to the resource.

Actual behavior

Setting the Accept Header inside the pre-matching request filter doesn't affect routing.

How to Reproduce?

Having following filter:

@PreMatching
@Provider
public class SetAcceptHeaderFilter implements ContainerRequestFilter {

    @Override
    public void filter(ContainerRequestContext requestContext) {
        requestContext.getHeaders().putSingle(HttpHeaders.ACCEPT, MediaType.TEXT_PLAIN);
    }
}

and following Resource:

@Path("/hello")
public class GreetingResource {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public Response helloText() { return Response.ok("correct").build(); }

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Response helloHtml() { return Response.ok("shall not happen").build(); }

Try to call it from the browser.

Output of uname -a or ver

No response

Output of java -version

java 17.0.9 2023-10-17 LTS

Quarkus version or git rev

2.6.12.Final and 3.6.4

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

Apache Maven 3.6.3

Additional information

Do you know some workaround to this issue? Such a thing shall be pretty common. I'm trying to implement CXF's _type Query Parameter,

@geoand
Copy link
Contributor

geoand commented Jan 10, 2024

Thanks for reporting. #38131 fixes the issue

Copy link

quarkus-bot bot commented Jan 10, 2024

/cc @FroMage (resteasy-reactive), @stuartwdouglas (resteasy-reactive)

geoand added a commit that referenced this issue Jan 10, 2024
Use headers set in PreMatching filter during media type negotiation
@quarkus-bot quarkus-bot bot added this to the 3.7 - main milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants