fix parsing query string
This commit is contained in:
@@ -26,7 +26,7 @@ public class ParseQS {
|
||||
for (String _pair : pairs) {
|
||||
String[] pair = _pair.split("=");
|
||||
qry.put(Global.decodeURIComponent(pair[0]),
|
||||
pair.length > 0 ? Global.decodeURIComponent(pair[1]) : "");
|
||||
pair.length > 1 ? Global.decodeURIComponent(pair[1]) : "");
|
||||
}
|
||||
return qry;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ public class ParseQSTest {
|
||||
|
||||
queryObject = ParseQS.decode("india=new%20delhi");
|
||||
assertThat(queryObject.get("india"), is("new delhi"));
|
||||
|
||||
queryObject = ParseQS.decode("woot=");
|
||||
assertThat(queryObject.get("woot"), is(""));
|
||||
|
||||
queryObject = ParseQS.decode("woot");
|
||||
assertThat(queryObject.get("woot"), is(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user