From f846d9484ce0813e9ed40933d5cc474feecac49f Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Wed, 3 Jan 2024 15:19:53 +0100 Subject: [PATCH] Add Javadoc to MockHttpServletResponse This commit adds Javadoc to the `getContentLength` method of `MockHttpServletResponse` to reflect that it gets its value from the HTTP response header. Closes gh-31833 --- .../springframework/mock/web/MockHttpServletResponse.java | 5 +++++ .../web/testfixture/servlet/MockHttpServletResponse.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java index c0df344d7d..9ee769a2d1 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java @@ -320,6 +320,11 @@ public class MockHttpServletResponse implements HttpServletResponse { doAddHeaderValue(HttpHeaders.CONTENT_LENGTH, contentLength, true); } + /** + * Get the length of the content body from the HTTP Content-Length header. + * @return the value of the Content-Length header + * @see #setContentLength(int) + */ public int getContentLength() { return (int) this.contentLength; } diff --git a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java index b88907feb7..e9064219cc 100644 --- a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java +++ b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java @@ -320,6 +320,11 @@ public class MockHttpServletResponse implements HttpServletResponse { doAddHeaderValue(HttpHeaders.CONTENT_LENGTH, contentLength, true); } + /** + * Get the length of the content body from the HTTP Content-Length header. + * @return the value of the Content-Length header + * @see #setContentLength(int) + */ public int getContentLength() { return (int) this.contentLength; }