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