This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 0229838ec4 Add test case for content-range 0229838ec4 is described below commit 0229838ec474ee604d900df8c5a96784d89d0ab5 Author: remm <r...@apache.org> AuthorDate: Mon Nov 18 14:22:19 2024 +0100 Add test case for content-range Submitted by Justin Chen. --- .../catalina/servlets/TestDefaultServletRangeRequests.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java index cd695019c0..1ebf851b01 100644 --- a/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java +++ b/test/org/apache/catalina/servlets/TestDefaultServletRangeRequests.java @@ -75,6 +75,8 @@ public class TestDefaultServletRangeRequests extends TomcatBaseTest { // Valid range parameterSets.add(new Object[] { "bytes=0-9", null, Integer.valueOf(206), "10", "0-9/" + len }); + parameterSets.add(new Object[] { + "bytes=0-9,10-10", null, Integer.valueOf(206), null, "0-9/" + len }); parameterSets.add(new Object[] { "bytes=-100", null, Integer.valueOf(206), "100", (len - 100) + "-" + (len - 1) + "/" + len }); parameterSets.add(new Object[] { @@ -140,7 +142,7 @@ public class TestDefaultServletRangeRequests extends TomcatBaseTest { // Check the result Assert.assertEquals(responseCodeExpected, rc); - if (contentLengthExpected.length() > 0) { + if (contentLengthExpected != null && contentLengthExpected.length() > 0) { String contentLength = responseHeaders.get("Content-Length").get(0); Assert.assertEquals(contentLengthExpected, contentLength); } @@ -151,7 +153,14 @@ public class TestDefaultServletRangeRequests extends TomcatBaseTest { if (headerValues != null && headerValues.size() == 1) { responseRange = headerValues.get(0); } - Assert.assertEquals("bytes " + responseRangeExpected, responseRange); + if (responseRange != null) { + Assert.assertEquals("bytes " + responseRangeExpected, responseRange); + } else { + Assert.assertTrue( + "Expected `Content-Range: " + "bytes " + responseRangeExpected + + "` in multipart/byteranges response body not found!", + responseBody.toString().contains("bytes " + responseRangeExpected)); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org