Add HttpUrl test
@@ -27,6 +27,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static io.datakernel.bytebuf.ByteBufPool.*;
+import static java.util.Collections.singletonMap;
import static junit.framework.TestCase.assertEquals;
import static org.junit.Assert.*;
@@ -357,4 +358,14 @@ public class HttpUrlTest {
final Set<String> actual = url.getQueryParameters().keySet();
assertThat(actual, IsEmptyCollection.empty());
}
+
+ @Test
+ public void testEmptyValueBeforeAmpersandWithSeparator() {
+ final Map<String, String> map = singletonMap("key", "");
+ final HttpUrl url = HttpUrl.of("http://abc.com/?key=&");
+ assertEquals(map, url.getQueryParameters());
+ for (String key : map.keySet()) {
+ assertEquals(map.get(key), url.getQueryParameter(key));
+ }
+ }
}
