mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-24 07:39:09 +00:00
Support Map payloads in FormHttpMessageConverter
Prior to this commit, the `FormHttpMessageConverter` would only support `MultiValueMap` payloads for reading and writing. While this can be useful when web forms contain multiple values under the same key, this prevent developers from using a common `Map` type and factory methods like `Map.of(...)`. This commit relaxes constraints in `FormHttpMessageConverter` and ensures that `Map` types are supported for reading and writing URL encoded forms. Note that when reading forms to a `Map`, only the first value for each key will be considered and other values will be dropped if they exist. Closes gh-36408
This commit is contained in:
@@ -26,6 +26,7 @@ By default, this converter supports all text media types(`text/{asterisk}`) and
|
||||
| An `HttpMessageConverter` implementation that can read and write URL encoded forms.
|
||||
By default, this converter reads and writes the `application/x-www-form-urlencoded` media type.
|
||||
Form data is read from and written into a `MultiValueMap<String, String>`.
|
||||
`Map<String, String>` is also supported, but multiple values under the same key will be ignored.
|
||||
|
||||
| `MultipartHttpMessageConverter`
|
||||
| An `HttpMessageConverter` implementation that can read and write multipart messages.
|
||||
|
||||
Reference in New Issue
Block a user