Detect Undertow RequestTooBigException message in handleParseFailure
Closes gh-32549
This commit is contained in:
@@ -123,6 +123,14 @@ class StandardMultipartHttpServletRequestTests {
|
||||
.isThrownBy(() -> requestWithException(ex)).withCause(ex);
|
||||
}
|
||||
|
||||
@Test // gh-32549
|
||||
void undertowRequestTooBigException() {
|
||||
IOException ex = new IOException("Connection terminated as request was larger than 10000");
|
||||
|
||||
assertThatExceptionOfType(MaxUploadSizeExceededException.class)
|
||||
.isThrownBy(() -> requestWithException(ex)).withCause(ex);
|
||||
}
|
||||
|
||||
|
||||
private static StandardMultipartHttpServletRequest requestWithPart(String name, String disposition, String content) {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
@@ -142,4 +150,14 @@ class StandardMultipartHttpServletRequestTests {
|
||||
return new StandardMultipartHttpServletRequest(request);
|
||||
}
|
||||
|
||||
private static StandardMultipartHttpServletRequest requestWithException(IOException ex) {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest() {
|
||||
@Override
|
||||
public Collection<Part> getParts() throws IOException {
|
||||
throw ex;
|
||||
}
|
||||
};
|
||||
return new StandardMultipartHttpServletRequest(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user