Skip to content

Commit 4f9d525

Browse files
authored
allow disabling read size restriction (#322)
now can set max allowed body size to -1 to disable size restriction. this came about because the flupke httpclient doesn't seem to send content length headers
1 parent 06b5696 commit 4f9d525

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

avaje-jex-test/src/main/java/io/avaje/jex/test/TestPair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static TestPair create(Jex app) {
5151
}
5252

5353
@Override
54-
public void close() throws Exception {
54+
public void close() {
5555
shutdown();
5656
}
5757
}

avaje-jex/src/main/java/io/avaje/jex/JexConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ default JexConfig httpsConfig(SSLContext sslContext) {
161161
int rangeChunkSize();
162162

163163
/**
164-
* Sets the the max size of request body that can be accessed without using using an InputStream
164+
* Sets the the max size of request body that can be accessed without using using an InputStream.
165+
*
166+
* <p>providing -1 means there is no limit
165167
*
166168
* @param maxRequestSize The size.
167169
*/

avaje-jex/src/main/java/io/avaje/jex/core/JdkContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public byte[] bodyAsBytes() {
127127
if (bodyBytes == null) {
128128
var contentLength = contentLength();
129129
long maxRequestSize = mgr.maxRequestSize();
130-
if (contentLength > maxRequestSize || contentLength < 0) {
130+
if (maxRequestSize > 0 && (contentLength > maxRequestSize || contentLength < 0)) {
131131
throw new HttpResponseException(
132132
HttpStatus.REQUEST_ENTITY_TOO_LARGE_413.status(),
133133
"Body content length unknown or greater than max configured size (%s bytes)"

0 commit comments

Comments
 (0)