Skip to content

RESTEasy reactive returns an empty InputStream instead of null on 204 - No Content response #31231

Closed
@kekbur

Description

Describe the bug

When a REST API returns a 204 - No Content response RESTEasy reactive client returns an empty InputStream instead of null.

This is the API client interface. For comparison, there is a second method that returns a javax.ws.rs.core.Response.

@ApplicationScoped
@RegisterRestClient(baseUri = "https://httpbin.org")
public interface RestApi {
	@GET
	@Path("/status/204")
	public InputStream getStream();
	
	@GET
	@Path("/status/204")
	public Response getResponse();
}

When using RESTEasy reactive, the following values are returned:
api.getStream() = an instance of VertxClientInputStream
api.getResponse().hasEntity() = false
api.getResponse().getEntity() = null

When using RESTEasy classic, the following values are returned:
api.getStream() = null
api.getResponse().hasEntity() = false
api.getResponse().getEntity() = null

Expected behavior

RESTEasy reactive returns null when an API client method with the return type InputStream receives a 204 - No Content response.

Actual behavior

RESTEasy reactive returns a VertxClientInputStream.

How to Reproduce?

Reproducer: code-with-quarkus.zip

  1. Run mvn test. Observe RestApiTest.testGetStreamNoContent failing.

Output of uname -a or ver

CYGWIN_NT-10.0-22000

Output of java -version

java version "17.0.3.1" 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.2.Final

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

Apache Maven 3.8.6

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions