0

I'm calling an endpoint where the information I need is returned in the response header (https://keycloak.discourse.group/t/rest-api-create-user-no-user-identifier-in-response/1964/4). How do I retrieve this information if I use Quarkus REST client (https://quarkus.io/guides/rest-client)?

I understand that I can use @ClientHeaderParam or @HeaderParam for putting header in the response. What I want is the opposite.

wiradikusuma
  • 1,930
  • 4
  • 28
  • 44

1 Answers1

5

You RestClient method should return a JAX-RS Response object instead of the payload so you can access the header from it via getHeaders.

loicmathieu
  • 5,181
  • 26
  • 31
  • 1
    This is correct, but note that in the reactive case (when return type is `Uni`) there seems to be a bug: `response.getEntity()` will return null (instead of an `InputStream`) even when the response has a normal body. See also [this issue on Quarkus](https://github.com/quarkusio/quarkus/issues/25496) – Michail Alexakis May 14 '22 at 17:26