forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand types which are considered text in multipart handling
Fixes: quarkusio#38802 (cherry picked from commit b3a9aa7)
- Loading branch information
Showing
4 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
.../io/quarkus/resteasy/reactive/server/test/multipart/MultipartTextWithoutFilenameTest.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,52 @@ | ||
package io.quarkus.resteasy.reactive.server.test.multipart; | ||
|
||
import static io.restassured.RestAssured.given; | ||
|
||
import java.io.IOException; | ||
import java.util.function.Supplier; | ||
|
||
import jakarta.ws.rs.FormParam; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
|
||
import org.jboss.resteasy.reactive.RestResponse; | ||
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; | ||
|
||
public class MultipartTextWithoutFilenameTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Resource.class); | ||
} | ||
}); | ||
|
||
@Test | ||
public void test() throws IOException { | ||
given() | ||
.contentType("multipart/form-data") | ||
.multiPart("firstParam", "{\"id\":\"myId\",\"name\":\"myName\"}", "application/json") | ||
.when() | ||
.post("/test") | ||
.then() | ||
.statusCode(200); | ||
} | ||
|
||
@Path("/test") | ||
public static class Resource { | ||
|
||
@POST | ||
public RestResponse<Void> testMultipart(@FormParam("firstParam") final String firstParam, | ||
@FormParam("secondParam") final String secondParam) { | ||
return RestResponse.ok(); | ||
} | ||
} | ||
} |
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
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
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