Skip to content

Commit

Permalink
Cleanup setPathQuery from #5954 (#5981)
Browse files Browse the repository at this point in the history
Cleanup setPathQuery from #5954 so that it does not retain an old query if the passed string does not contain a query
  • Loading branch information
gregw committed Feb 17, 2021
1 parent 322d101 commit ad6fc62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -705,6 +705,7 @@ public Mutable pathQuery(String pathQuery)
_path = null;
_decodedPath = null;
_param = null;
_query = null;
if (pathQuery != null)
parse(State.PATH, pathQuery);
return this;
Expand Down
Expand Up @@ -236,6 +236,13 @@ public void testMutableURIBuilder()
assertEquals("p2", uri.getParam());
assertEquals("name=value", uri.getQuery());

uri = builder.pathQuery("/f%30%30;p0/bar;p1;p2").asImmutable();
assertEquals("http://host:8888/f%30%30;p0/bar;p1;p2", uri.toString());
assertEquals("/f%30%30;p0/bar;p1;p2", uri.getPath());
assertEquals("/f00/bar", uri.getDecodedPath());
assertEquals("p2", uri.getParam());
assertEquals(null, uri.getQuery());

uri = builder.query("other=123456").asImmutable();
assertEquals("http://host:8888/f%30%30;p0/bar;p1;p2?other=123456", uri.toString());
assertEquals("/f%30%30;p0/bar;p1;p2", uri.getPath());
Expand Down

0 comments on commit ad6fc62

Please sign in to comment.