Hi,

I run into trouble on generating a simple plain text reply.
If my response contains a string as entity and the endpoint is marked to
generate a plain text media type I would assume that the body of the
response contains exactly that string without any additional characters.

If my observation has been correct the response string entity is placed
into quotes.

@GET
@Path("foo")
@Produces(MediaType.TEXT_PLAIN)
public Response foo() {
    return Response.ok("foo").build();
}

I would expect (because of "text plain") that the response body is
foo
But it is
"foo"

$ curl -v 'http://127.0.0.1:8080/rest/test/foo'
*   Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /rest/test/foo HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.65.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 13 Jan 2020 14:30:28 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
<
* Connection #0 to host 127.0.0.1 left intact
"foo"

Can you please explain what I am doing wrong?

Reply via email to