Various MultiValueMap improvements

This commit makes several improvements to MultiValueMap:
- asSingleValueMap offers a single-value view (as opposed to the
  existing toSingleValueMap, which offers a copy)
- fromSingleValue is a static method that adapts a Map<?,?> to the
  MultiValueMap interface
- fromMultiValue is a static method that adapts a Map<?,List<?>> to the
  MultiValueMap interface

Closes gh-32832
This commit is contained in:
Arjen Poutsma
2024-05-21 15:51:31 +02:00
parent 97647ef5f6
commit 903493e9a9
12 changed files with 978 additions and 8 deletions

View File

@@ -146,7 +146,7 @@ class RedirectViewTests {
assertThat(response.getHeader("Location")).isEqualTo("https://url.somewhere.com/path?id=1");
assertThat(flashMap.getTargetRequestPath()).isEqualTo("/path");
assertThat(flashMap.getTargetRequestParams().toSingleValueMap()).isEqualTo(model);
assertThat(flashMap.getTargetRequestParams().asSingleValueMap()).isEqualTo(model);
}
@Test