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

REST Client not sending headers from shared configKey #44989

Closed
jburkal opened this issue Dec 8, 2024 · 2 comments · Fixed by #45044
Closed

REST Client not sending headers from shared configKey #44989

jburkal opened this issue Dec 8, 2024 · 2 comments · Fixed by #45044
Assignees
Labels
Milestone

Comments

@jburkal
Copy link

jburkal commented Dec 8, 2024

Describe the bug

When multiple REST Client classes uses the same value for configKey in their @RegisterRestClient annotation, headers specified in application.properties (using the quarkus.rest-client."client".headers."header-name" format) are no longer sent for all of the clients.

Expected behavior

Headers specified in the configuration of a specific REST client, e.g.:

quarkus.rest-client."testClient".headers."My-Header"=Test Header

should be sent on requests from all classes annotated with @RegisterRestClient(configKey = "testClient")

Actual behavior

Since Quarkus 3.17.0, the headers are only sent for one of the REST client classes.

It works as expected in both Quarkus 3.15.2 and 3.16.4.

How to Reproduce?

Reproducer: https://github.com/jburkal/quarkus-rest-header-test

Running the application (./mvnw quarkus:dev) with Quarkus 3.15.2 or 3.16.4 produces log lines such as:

DEBUG [org.jbo.res.rea.cli.log.DefaultClientLogger] Request: GET https://stage.code.quarkus.io/api/extensions?id=quarkus-rest-client Headers[My-Header=Test Header User-Agent=Test User Agent], Empty body
DEBUG [org.jbo.res.rea.cli.log.DefaultClientLogger] Request: GET https://stage.code.quarkus.io/api/streams Headers[My-Header=Test Header User-Agent=Test User Agent], Empty body

whereas with Quarkus 3.17.0 and newer, it looks like this:

DEBUG [org.jbo.res.rea.cli.log.DefaultClientLogger] Request: GET https://stage.code.quarkus.io/api/extensions?id=quarkus-rest-client Headers[My-Header=Test Header User-Agent=Test User Agent], Empty body
DEBUG [org.jbo.res.rea.cli.log.DefaultClientLogger] Request: GET https://stage.code.quarkus.io/api/streams Headers[User-Agent=Test User Agent], Empty body

Note that the second request no longer contains the "My-Header" header.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.17.0

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

No response

Additional information

No response

@jburkal jburkal added the kind/bug Something isn't working label Dec 8, 2024
Copy link

quarkus-bot bot commented Dec 8, 2024

/cc @cescoffier (rest-client), @geoand (rest-client), @radcortez (config)

@radcortez
Copy link
Member

For now, please use the FQN of the REST Client to set up the configuration.

@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Dec 11, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.5 Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants