@@ -63,6 +63,17 @@ public void getMaxRequestBodySize() {
6363 assertMaxConfiguredSize ("multipart/form-data" , 5 , configuration );
6464 assertMaxConfiguredSize ("text/css" , 6 , configuration );
6565 assertMaxConfiguredSize ("text/html" , 7 , configuration );
66+
67+ // We don't expect this at runtime, but ideally we won't explode. These would be invalid values.
68+ // - Some of these are legit Content-Type headers, but at runtime we will have already parsed the header so we do
69+ // not expect any attributes;
70+ assertMaxConfiguredSize ("" , 1 , configuration );
71+ assertMaxConfiguredSize ("null" , 1 , configuration );
72+ assertMaxConfiguredSize ("application/json; foo=bar" , 2 , configuration );
73+ assertMaxConfiguredSize ("multipart/form-data; boundary=------" , 1 , configuration );
74+ assertMaxConfiguredSize ("text/css; charset=ISO-8859-1" , 6 , configuration );
75+ assertMaxConfiguredSize ("text/unexpected" , 6 , configuration );
76+ assertMaxConfiguredSize ("text/unexpected/value" , 6 , configuration );
6677 }
6778
6879 @ Test
@@ -264,7 +275,7 @@ private void assertHexValue(String s, String expected, Charset charset) {
264275 }
265276
266277 private void assertMaxConfiguredSize (String contentType , int maximumSize , Map <String , Integer > maxRequestBodySize ) {
267- assertEquals (maximumSize , HTTPTools .getMaxRequestBodySize (contentType , maxRequestBodySize ));
278+ assertEquals (HTTPTools .getMaxRequestBodySize (contentType , maxRequestBodySize ), maximumSize );
268279 }
269280
270281 private String hex (byte [] bytes ) {
0 commit comments