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

Produced MIME type declaration not honoured in reactive routes #10960

Closed
jponge opened this issue Jul 24, 2020 · 0 comments · Fixed by #11014
Closed

Produced MIME type declaration not honoured in reactive routes #10960

jponge opened this issue Jul 24, 2020 · 0 comments · Fixed by #11014
Labels
kind/bug Something isn't working
Milestone

Comments

@jponge
Copy link
Member

jponge commented Jul 24, 2020

With Quarkus 1.6.1.Final and the following reactive routes code:

@ApplicationScoped
public class Routes {

    @Route(methods = HttpMethod.GET, path = "/hello", produces = "text/plain")
    void hello(RoutingContext context) {
        context.response().end("hello");
    }

    @Route(methods = HttpMethod.GET, path = "/hi/:name", produces = "application/json")
    void hi(RoutingExchange routing) {
        String name = routing.getParam("name").orElse("what?");
        routing.ok(new JsonObject()
                .put("name", name)
                .put("timestamp", System.currentTimeMillis()).encode());
    }
}

then the produced MIME content is not honoured (the Content-Type header is missing), see:

$ http :8080/hi/mrbean
HTTP/1.1 200 OK
content-length: 43

{"name":"mrbean","timestamp":1595608877519}

and:

$ http :8080/hello
HTTP/1.1 200 OK
content-length: 5

hello
@jponge jponge added the kind/bug Something isn't working label Jul 24, 2020
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jul 28, 2020
Currently if the request does not include an Accept header the
method will still be invoked but the content type will not
always be automatically set.

Fixes quarkusio#10960
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jul 28, 2020
Currently if the request does not include an Accept header the
method will still be invoked but the content type will not
always be automatically set.

Fixes quarkusio#10960
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jul 29, 2020
Currently if the request does not include an Accept header the
method will still be invoked but the content type will not
always be automatically set.

Fixes quarkusio#10960
@gsmet gsmet added this to the 1.7.0.CR1 - master milestone Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants