spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.77k stars 38.16k forks source link

When Accept-Language header is blank, the default locale should be returned #33888

Closed lllichen closed 1 week ago

lllichen commented 2 weeks ago
lllichen commented 2 weeks ago

image

bclozel commented 2 weeks ago

Sending such a request header with an "empty text" value is I think invalid HTTP. Can you name an HTTP client that does this?

ririnto commented 1 week ago

I don't think this is a common case.

Is there a case where this change would be useful?

lllichen commented 1 week ago

Sending such a request header with an "empty text" value is I think invalid HTTP. Can you name an HTTP client that does this?

Sending such a request header with an "empty text" value is I think invalid HTTP. Can you name an HTTP client that does this?

I think what you said is correct. However, sometimes the "accept_language" is manually added by the front-end colleagues. If they don't include this, I expect the return value to be the default value that I have set, rather than the default language of the machine.

lllichen commented 1 week ago

Of course, this is just my suggestion. I've already overridden this class locally to solve this problem.

bclozel commented 1 week ago

Thanks for letting us know. Let's consider this an invalid usage right now.