Permalink
Browse files

[#1302] Remove whitespace before adding language to the list

[#1302] prove fix w/ unit test
  • Loading branch information...
1 parent 8c0d068 commit 7af40f458572b827e023970a0a7de3881e14ff12 Igmar Palsenberg committed with Notalifeform Jan 21, 2013
Showing with 10 additions and 2 deletions.
  1. +2 −2 framework/src/play/mvc/Http.java
  2. +8 −0 framework/test-src/play/i18n/LangTest.java
@@ -538,7 +538,7 @@ public int compare(String lang1, String lang2) {
});
List<String> result = new ArrayList<String>(10);
for (String lang : languages) {
- result.add(lang.split(";")[0]);
+ result.add(lang.trim().split(";")[0]);
}
return result;
}
@@ -932,4 +932,4 @@ public WebSocketFrame(byte[] data) {
public static class WebSocketClose extends WebSocketEvent {
}
-}
+}
@@ -107,6 +107,14 @@ public void testGet() {
Lang.current.set(null);
assertLocale(new Locale("en"));
+
+ // prove lighthouse fix https://play.lighthouseapp.com/projects/57987/tickets/1302
+ // space in accept language header
+ req = FunctionalTest.newRequest();
+ req.headers.put("accept-language", new Http.Header("accept-language", "nl, en;q=0.8"));
+ Http.Request.current.set(req);
+ Lang.current.set(null);
+ assertLocale(new Locale("en"));
// check with cookie value
req = FunctionalTest.newRequest();

0 comments on commit 7af40f4

Please sign in to comment.