Skip to content

Commit

Permalink
glob
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Aug 11, 2023
1 parent 3022ad5 commit a838d55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ static String globToRegex(String glob) {
case '?':
tokens.append('.');
break;
case '[':
tokens.append('[');
break;
case ']':
tokens.append(']');
break;
case '{':
inGroup = true;
tokens.append('(');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,15 @@ void shouldNotFollowRedirectsWhenMaxRedirectsIsSetTo0InRouteFetch() {
page.navigate(server.PREFIX + "/foo");
assertTrue(page.content().contains("hello"));
}

@Test
void shouldProperlyHandleCharacterSetsInGlobs() {
page.route("**/[a-z]*.html", route -> {
APIResponse response = route.fetch(new Route.FetchOptions().setUrl(server.PREFIX + "/one-style.html"));
route.fulfill(new Route.FulfillOptions().setResponse(response));
});
Response response = page.navigate(server.PREFIX + "/empty.html");
assertEquals(200, response.status());
assertTrue(response.text().contains("one-style.css"), response.text());
}
}

0 comments on commit a838d55

Please sign in to comment.