Skip to content

Commit

Permalink
Merge pull request #26101 from geoand/#26016
Browse files Browse the repository at this point in the history
Make RESTEasy Reactive path matching more spec compliant
  • Loading branch information
gastaldi authored Jun 14, 2022
2 parents f08bcae + 36e95a0 commit 9a24d12
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class StorkResponseTimeLoadBalancerTest {
@BeforeAll
public static void setUp() {
server = new WireMockServer(options().port(8766));
server.stubFor(WireMock.post("/hello/")
server.stubFor(WireMock.post("/hello")
.willReturn(aResponse().withFixedDelay(1000)
.withBody(SLOW_RESPONSE).withStatus(200)));
server.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ protected List<ResourceMethod> createEndpoints(ClassInfo currentClassInfo,
if (!methodPath.startsWith("/")) {
methodPath = "/" + methodPath;
}
if (methodPath.endsWith("/")) {
methodPath = methodPath.substring(0, methodPath.length() - 1);
}
} else {
methodPath = "";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.jboss.resteasy.reactive.server.vertx.test.matching;

import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.equalTo;

import java.util.function.Supplier;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jboss.resteasy.reactive.server.vertx.test.framework.ResteasyReactiveUnitTest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

public class EndingSlashTest {

@RegisterExtension
static ResteasyReactiveUnitTest test = new ResteasyReactiveUnitTest()
.setArchiveProducer(new Supplier<>() {
@Override
public JavaArchive get() {
return ShrinkWrap.create(JavaArchive.class)
.addClasses(TestResource.class);
}
});

@Test
public void test() {
get("/hello/world")
.then()
.statusCode(200)
.body(equalTo("Hello World!"));

get("/hello/world/")
.then()
.statusCode(200)
.body(equalTo("Hello World!"));
}

@Path("/hello")
public static class TestResource {

@GET
@Path("/world/")
@Produces(MediaType.TEXT_PLAIN)
public String test() {
return "Hello World!";
}
}
}

0 comments on commit 9a24d12

Please sign in to comment.