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

Add the ability to set HTTP headers and Response status when returning Reactive Types from RESTEasy Reactive #20100

Closed
geoand opened this issue Sep 13, 2021 · 8 comments · Fixed by #20311
Assignees
Labels
area/rest kind/enhancement New feature or request
Milestone

Comments

@geoand
Copy link
Contributor

geoand commented Sep 13, 2021

Description

Currently when returning a Uni or Multi, there is no easy way to set a response header or a the HTTP status.
We should provide and document a way to do this.

Implementation ideas

There are two ways I can think of:

  1. We introduce @Header and @Status annotations that can be placed on a resource method and if the method was executed properly, these annotations set the corresponding response properties.
  2. We allow the use of RestResponse<Uni<T>> and RestResponse<Multi<T>>. This would allow more control, but might be more cumbersome to use.

WDYT @FroMage @stuartwdouglas ?

@geoand geoand added the kind/enhancement New feature or request label Sep 13, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 13, 2021

/cc @FroMage, @stuartwdouglas

@ambition-consulting
Copy link

Hate to be pushing again - but yes, we definitely need this. Not sure if we are the first enterprise application using reactive server+client with quarkus, but this stuff is fundamental!

@geoand
Copy link
Contributor Author

geoand commented Sep 21, 2021

We'll likely add this soon.

@FroMage
Copy link
Member

FroMage commented Sep 21, 2021

Can't we return a Uni<RestResponse<>> ATM? The docs say we can from filters and exception mappers, so I assume we can from endpoints too.

@geoand
Copy link
Contributor Author

geoand commented Sep 21, 2021

I think that works, but it only covers that one use case. I'll open a POC PR for the annotations I proposed, soon

geoand added a commit to geoand/quarkus that referenced this issue Sep 21, 2021
@geoand
Copy link
Contributor Author

geoand commented Sep 21, 2021

#20311 is what I had in mind

geoand added a commit to geoand/quarkus that referenced this issue Sep 21, 2021
geoand added a commit to geoand/quarkus that referenced this issue Sep 29, 2021
@mschorsch
Copy link
Contributor

mschorsch commented Oct 13, 2021

@geoand Is Flow<T> (Kotlin) also supported (#20345 )? I had this use case some days ago.

@geoand
Copy link
Contributor Author

geoand commented Oct 13, 2021

Yes it is. Feel free to comment about that on the Pull Request

geoand added a commit to geoand/quarkus that referenced this issue Oct 13, 2021
geoand added a commit to geoand/quarkus that referenced this issue Oct 14, 2021
geoand added a commit to geoand/quarkus that referenced this issue Oct 14, 2021
geoand added a commit that referenced this issue Oct 14, 2021
Add support for @ResponseStatus and @ResponseHeader
@quarkus-bot quarkus-bot bot added this to the 2.5 - main milestone Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment