File tree 2 files changed +7
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -467,7 +467,7 @@ public void setAcceptLanguage(List<Locale.LanguageRange> languages) {
467
467
*/
468
468
public List <Locale .LanguageRange > getAcceptLanguage () {
469
469
String value = getFirst (ACCEPT_LANGUAGE );
470
- return value != null ? Locale .LanguageRange .parse (value ) : Collections .emptyList ();
470
+ return StringUtils . hasText ( value ) ? Locale .LanguageRange .parse (value ) : Collections .emptyList ();
471
471
}
472
472
473
473
/**
Original file line number Diff line number Diff line change @@ -447,6 +447,12 @@ public void acceptLanguage() {
447
447
assertEquals (Locale .FRANCE , headers .getAcceptLanguageAsLocales ().get (0 ));
448
448
}
449
449
450
+ @ Test // SPR-15603
451
+ public void acceptLanguageWithEmptyValue () throws Exception {
452
+ this .headers .set (HttpHeaders .ACCEPT_LANGUAGE , "" );
453
+ assertEquals (Collections .emptyList (), this .headers .getAcceptLanguageAsLocales ());
454
+ }
455
+
450
456
@ Test
451
457
public void contentLanguage () {
452
458
headers .setContentLanguage (Locale .FRANCE );
You can’t perform that action at this time.
0 commit comments