Revert "WIP"
This reverts commit c09b0f57631905a7b9cca32be5516853e4263ac0.
This commit is contained in:
@@ -117,14 +117,13 @@ class FormHttpMessageConverterTests {
|
||||
assertCanWrite(MULTIPART_RELATED);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
void readMultiValueForm() throws Exception {
|
||||
void readForm() throws Exception {
|
||||
String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.ISO_8859_1));
|
||||
inputMessage.getHeaders().setContentType(
|
||||
new MediaType("application", "x-www-form-urlencoded", StandardCharsets.ISO_8859_1));
|
||||
MultiValueMap<String, String> result = (MultiValueMap<String, String>) this.converter.read(null, inputMessage);
|
||||
MultiValueMap<String, String> result = this.converter.read(null, inputMessage);
|
||||
|
||||
assertThat(result).as("Invalid result").hasSize(3);
|
||||
assertThat(result.getFirst("name 1")).as("Invalid result").isEqualTo("value 1");
|
||||
@@ -133,21 +132,6 @@ class FormHttpMessageConverterTests {
|
||||
assertThat(result.getFirst("name 3")).as("Invalid result").isNull();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
void readSingleValueForm() throws Exception {
|
||||
String body = "name+1=value+1&name+2=value+2&name+3";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.ISO_8859_1));
|
||||
inputMessage.getHeaders().setContentType(
|
||||
new MediaType("application", "x-www-form-urlencoded", StandardCharsets.ISO_8859_1));
|
||||
Map<String, String> result = (Map<String, String>) this.converter.read((Class<? extends Map<String, ?>>) Map.class, inputMessage);
|
||||
|
||||
assertThat(result).as("Invalid result").hasSize(3);
|
||||
assertThat(result.get("name 1")).as("Invalid result").isEqualTo("value 1");
|
||||
assertThat(result.get("name 2")).as("Invalid result").isEqualTo("value 2");
|
||||
assertThat(result.get("name 3")).as("Invalid result").isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void writeForm() throws IOException {
|
||||
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
|
||||
|
||||
Reference in New Issue
Block a user