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

Missing Accept-Language header results in an empty list with getAcceptableLanguages() #44253

Closed
koplas opened this issue Nov 1, 2024 · 2 comments · Fixed by #44259
Closed
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@koplas
Copy link
Contributor

koplas commented Nov 1, 2024

Describe the bug

The Reactive Resteasy implementation of jakarta.ws.rs.core.HttpHeaders differs from the documentation. If a request contains no Accept-Language header and HttpHeaders.getAcceptableLangauges() is called, it will return an empty list.

The documentation specifies that a wildcard locale is returned, if no acceptable languages are specified: https://jakarta.ee/specifications/platform/10/apidocs/jakarta/ws/rs/core/httpheaders#getAcceptableLanguages().

Expected behavior

Calling HttpHeaders.getAcceptableLangauges() returns a list with a single wildcard locale, if no acceptable language header is given.

Actual behavior

Calling HttpHeaders.getAcceptableLangauges() returns an empty list, if no acceptable language header is given.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

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

No response

Additional information

The reason for this issue is here:


Instead of returning an empty list, it should return a wildcard locale, like it is done here: https://github.com/resteasy/resteasy/blob/91f23fff5eca4b45fba4f45b938dca2fe5c0d16d/resteasy-core/src/main/java/org/jboss/resteasy/specimpl/ResteasyHttpHeaders.java#L232

@koplas koplas added the kind/bug Something isn't working label Nov 1, 2024
Copy link

quarkus-bot bot commented Nov 1, 2024

/cc @FroMage (rest), @stuartwdouglas (rest)

@geoand
Copy link
Contributor

geoand commented Nov 1, 2024

You are free to try it and we can see what CI says :)

koplas added a commit to koplas/quarkus that referenced this issue Nov 1, 2024
`jakarta.ws.rs.core.HttpHeaders.getAcceptableLangauges` requires
that a wildcard locale is returned, if no acceptable language is
specified. The previous behavior returned an empty list.

Closes quarkusio#44253
koplas added a commit to koplas/quarkus that referenced this issue Nov 1, 2024
`jakarta.ws.rs.core.HttpHeaders.getAcceptableLanguages` requires
that a wildcard locale is returned, if no acceptable language is
specified. The previous behavior returned an empty list.

Closes quarkusio#44253
@geoand geoand closed this as completed in 5ad6ccb Nov 6, 2024
@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Nov 6, 2024
bschuhmann pushed a commit to bschuhmann/quarkus that referenced this issue Nov 16, 2024
`jakarta.ws.rs.core.HttpHeaders.getAcceptableLanguages` requires
that a wildcard locale is returned, if no acceptable language is
specified. The previous behavior returned an empty list.

Closes quarkusio#44253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants