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.
If the response is an exact multiple of the buffer size it is being truncated. Fixes quarkusio#22973
- Loading branch information
1 parent
a039ce4
commit 6a7a0f7
Showing
3 changed files
with
102 additions
and
27 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.../resteasy-jackson/deployment/src/test/java/io/quarkus/resteasy/jackson/LargeResource.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,39 @@ | ||
package io.quarkus.resteasy.jackson; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Produces(MediaType.APPLICATION_JSON) | ||
@Path("/large") | ||
public class LargeResource { | ||
|
||
@GET | ||
@Path("/bufmult") | ||
public Map<String, String> hello() { | ||
Map<String, String> ret = new HashMap<>(); | ||
for (int i = 0; i < 830; ++i) { | ||
if (i == 0) { | ||
//hack to make this exactly 2 * 8191 bytes long, as tested by trial and error | ||
ret.put("key00", "value" + i); | ||
} else { | ||
ret.put("key" + i, "value" + i); | ||
} | ||
} | ||
return ret; | ||
} | ||
|
||
@GET | ||
@Path("/huge") | ||
public Map<String, String> huge() { | ||
Map<String, String> ret = new HashMap<>(); | ||
for (int i = 0; i < 1280; ++i) { | ||
ret.put("key" + i, "value" + i); | ||
} | ||
return ret; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...teasy-jackson/deployment/src/test/java/io/quarkus/resteasy/jackson/LargeResponseTest.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,32 @@ | ||
package io.quarkus.resteasy.jackson; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class LargeResponseTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(LargeResource.class)); | ||
|
||
@Test | ||
public void testLargeResponseMultipleOfBuffer() { | ||
RestAssured.get("/large/bufmult").then() | ||
.statusCode(200) | ||
.body("key500", equalTo("value500")); | ||
} | ||
|
||
@Test | ||
public void testLargeResponse() { | ||
RestAssured.get("/large/huge").then() | ||
.statusCode(200) | ||
.body("key500", equalTo("value500")); | ||
} | ||
|
||
} |
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