Skip to content

Commit

Permalink
Don't require trailing / for servlet context
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and gsmet committed Apr 20, 2020
1 parent 90a569d commit 87c15bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public ServiceStartBuildItem boot(UndertowDeploymentRecorder recorder,
undertowProducer.accept(new DefaultRouteBuildItem(ut));
} else {
routeProducer.produce(new RouteBuildItem(servletContextPathBuildItem.getServletContextPath() + "/*", ut, false));
routeProducer.produce(new RouteBuildItem(servletContextPathBuildItem.getServletContextPath(), ut, false));
}
return new ServiceStartBuildItem("undertow");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class ContextPathTestCase {
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(TestServlet.class, TestGreeter.class)
.addAsResource(new StringAsset("index"), "META-INF/resources/index.html")
.addAsResource(new StringAsset("quarkus.servlet.context-path=" + CONTEXT_PATH), "application.properties"));

@Test
Expand All @@ -28,4 +29,12 @@ public void testServlet() {
.body(is("test servlet"));
}

@Test
public void testNoSlash() {
RestAssured.given().redirects().follow(false).when().get("/foo").then()
.statusCode(302);
RestAssured.when().get("/foo").then()
.statusCode(200)
.body(is("index"));
}
}

0 comments on commit 87c15bd

Please sign in to comment.