Use entrySet iterator in getBodyFromServletRequestParameters

Closes gh-27081
This commit is contained in:
Juergen Hoeller
2021-07-12 17:43:19 +02:00
parent 475396b516
commit 128689e79b
2 changed files with 16 additions and 5 deletions

View File

@@ -175,4 +175,14 @@ public class ServletServerHttpRequestTests {
assertThat(result).as("Invalid content returned").isEqualTo(content);
}
@Test
void getEmptyFormBody() throws IOException {
mockRequest.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
mockRequest.setMethod("POST");
byte[] result = FileCopyUtils.copyToByteArray(request.getBody());
byte[] content = "".getBytes(StandardCharsets.UTF_8);
assertThat(result).as("Invalid content returned").isEqualTo(content);
}
}