Skip to content

Commit 589b6db

Browse files
committed
Merge branch '6.1.x'
2 parents b3005fc + c1229b0 commit 589b6db

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ public MockHttpServletRequestBuilder queryParams(MultiValueMap<String, String> p
428428
}
429429

430430
/**
431-
* Appends the given value(s) to the given form field and also add to the
432-
* {@link #param(String, String...) request parameters} map.
431+
* Append the given value(s) to the given form field and also add them to the
432+
* {@linkplain #param(String, String...) request parameters} map.
433433
* @param name the field name
434434
* @param values one or more values
435435
* @since 6.1.7
@@ -783,14 +783,14 @@ public final MockHttpServletRequest buildRequest(ServletContext servletContext)
783783
if (this.content != null && this.content.length > 0) {
784784
throw new IllegalStateException("Could not write form data with an existing body");
785785
}
786-
Charset charset = (this.characterEncoding != null
787-
? Charset.forName(this.characterEncoding) : StandardCharsets.UTF_8);
788-
MediaType mediaType = (request.getContentType() != null
789-
? MediaType.parseMediaType(request.getContentType())
790-
: new MediaType(MediaType.APPLICATION_FORM_URLENCODED, charset));
786+
Charset charset = (this.characterEncoding != null ?
787+
Charset.forName(this.characterEncoding) : StandardCharsets.UTF_8);
788+
MediaType mediaType = (request.getContentType() != null ?
789+
MediaType.parseMediaType(request.getContentType()) :
790+
new MediaType(MediaType.APPLICATION_FORM_URLENCODED, charset));
791791
if (!mediaType.isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED)) {
792-
throw new IllegalStateException("Invalid content type: '" + mediaType
793-
+ "' is not compatible with '" + MediaType.APPLICATION_FORM_URLENCODED + "'");
792+
throw new IllegalStateException("Invalid content type: '" + mediaType +
793+
"' is not compatible with '" + MediaType.APPLICATION_FORM_URLENCODED + "'");
794794
}
795795
request.setContent(writeFormData(mediaType, charset));
796796
if (request.getContentType() == null) {

0 commit comments

Comments
 (0)