-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23004 from FroMage/22408
RR: Fix abort chain order for #22408
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...ent/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/Issue22408TestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package io.quarkus.resteasy.reactive.server.test.simple; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.container.ContainerResponseContext; | ||
import javax.ws.rs.core.Response; | ||
|
||
import org.jboss.resteasy.reactive.server.ServerExceptionMapper; | ||
import org.jboss.resteasy.reactive.server.ServerResponseFilter; | ||
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; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class Issue22408TestCase { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(MyFilters.class, MyResource.class); | ||
} | ||
}); | ||
|
||
@Test | ||
public void simpleTest() { | ||
RestAssured.get("/") | ||
.then().statusCode(204); | ||
} | ||
|
||
public static class MyFilters { | ||
|
||
@ServerExceptionMapper | ||
public Response mapException(RuntimeException x) { | ||
// this should get us a 204 which masks the original 405 | ||
return null; | ||
} | ||
|
||
@ServerResponseFilter | ||
public void responseFilter(ContainerResponseContext ctx) { | ||
// NPE because the response was not set yet | ||
ctx.getEntity(); | ||
} | ||
} | ||
|
||
@Path("/") | ||
public static class MyResource { | ||
// by calling a GET here we generate a 405 | ||
@POST | ||
public String get() { | ||
return "Hello"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters