Skip to content

Commit 2d1e58b

Browse files
committed
Polish
1 parent f6504c5 commit 2d1e58b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public class MockHttpServletRequestBuilder
145145
* <p>Although this class cannot be extended, additional ways to initialize
146146
* the {@code MockHttpServletRequest} can be plugged in via
147147
* {@link #with(RequestPostProcessor)}.
148-
* @param httpMethod the HTTP method (GET, POST, etc)
148+
* @param httpMethod the HTTP method (GET, POST, etc.)
149149
* @param url a URL template; the resulting URL will be encoded
150150
* @param vars zero or more URI variables
151151
*/
@@ -164,7 +164,7 @@ private static URI initUri(String url, Object[] vars) {
164164
/**
165165
* Alternative to {@link #MockHttpServletRequestBuilder(HttpMethod, String, Object...)}
166166
* with a pre-built URI.
167-
* @param httpMethod the HTTP method (GET, POST, etc)
167+
* @param httpMethod the HTTP method (GET, POST, etc.)
168168
* @param url the URL
169169
* @since 4.0.3
170170
*/
@@ -797,7 +797,7 @@ public final MockHttpServletRequest buildRequest(ServletContext servletContext)
797797
}
798798
}
799799
catch (Exception ex) {
800-
// Must be invalid, ignore..
800+
// Must be invalid, ignore
801801
}
802802
}
803803
}
@@ -894,7 +894,8 @@ private MultiValueMap<String, String> parseFormData(MediaType mediaType) {
894894
HttpInputMessage message = new HttpInputMessage() {
895895
@Override
896896
public InputStream getBody() {
897-
return (content != null ? new ByteArrayInputStream(content) : InputStream.nullInputStream());
897+
byte[] bodyContent = MockHttpServletRequestBuilder.this.content;
898+
return (bodyContent != null ? new ByteArrayInputStream(bodyContent) : InputStream.nullInputStream());
898899
}
899900
@Override
900901
public HttpHeaders getHeaders() {

spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static MockHttpServletRequestBuilder head(URI uri) {
176176

177177
/**
178178
* Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method.
179-
* @param method the HTTP method (GET, POST, etc)
179+
* @param method the HTTP method (GET, POST, etc.)
180180
* @param urlTemplate a URL template; the resulting URL will be encoded
181181
* @param uriVariables zero or more URI variables
182182
*/
@@ -186,7 +186,7 @@ public static MockHttpServletRequestBuilder request(HttpMethod method, String ur
186186

187187
/**
188188
* Create a {@link MockHttpServletRequestBuilder} for a request with the given HTTP method.
189-
* @param httpMethod the HTTP method (GET, POST, etc)
189+
* @param httpMethod the HTTP method (GET, POST, etc.)
190190
* @param uri the URL
191191
* @since 4.0.3
192192
*/

0 commit comments

Comments
 (0)