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: Content type incorrect for Qute templates #25932

Closed
FroMage opened this issue Jun 2, 2022 · 4 comments · Fixed by #25945
Closed

RESTEasy Reactive: Content type incorrect for Qute templates #25932

FroMage opened this issue Jun 2, 2022 · 4 comments · Fixed by #25945
Labels
area/qute The template engine area/rest kind/bug Something isn't working
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Jun 2, 2022

Describe the bug

efecf5e introduced a bug because the TemplateResponseFilter used to set the Content Type:

            if (mediaType != null) {
                responseContext.setEntity(r, null, mediaType);
            } else {
                responseContext.setEntity(r);
            }

While the new behaviour in TemplateResponseUniHandler does not:

        requestContext.setResult(createUni(requestContext, (TemplateInstance) result, engine));
    }

    private Uni<String> createUni(ResteasyReactiveRequestContext requestContext, TemplateInstance result, Engine engine) {
        setSelectedVariant(result, requestContext.getRequest(),
                requestContext.getHttpHeaders().getAcceptableLanguages());
        return toUni(result, engine);
    }

As a result, Qute HTML templates now get their content type set to text/plain; charset=utf8 which is incorrect. A bit scary that we don't have a test for this too…

@FroMage FroMage added kind/bug Something isn't working area/qute The template engine area/rest labels Jun 2, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 2, 2022

/cc @geoand, @mkouba, @stuartwdouglas

@geoand
Copy link
Contributor

geoand commented Jun 2, 2022

Seems like you have a fix really 😎.

Mind providing a PR?

@geoand
Copy link
Contributor

geoand commented Jun 2, 2022

Also, it would be great to have a simple way to reproduce this

@geoand
Copy link
Contributor

geoand commented Jun 3, 2022

@FroMage could you test #25945?

gsmet added a commit that referenced this issue Jun 9, 2022
Set content-type for Qute templates in RESTEasy Reactive
@quarkus-bot quarkus-bot bot added this to the 2.10 - main milestone Jun 9, 2022
FroMage added a commit to FroMage/quarkus that referenced this issue Jun 10, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/qute The template engine area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants