Package io.micronaut.http.server.filter
Interface FilterBodyParser
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
@DefaultImplementation(io.micronaut.http.server.filter.DefaultFilterBodyParser.class)
public interface FilterBodyParser
API to parse a request body within a server filter.
- Since:
- 4.7.1
- Author:
- Sergio del Amo
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionparseBody
(HttpRequest<?> request) Attempts to parse the request body into a Map.
-
Method Details
-
parseBody
Attempts to parse the request body into a Map. The default implementationDefaultFilterBodyParser
usesFormUrlEncodedDecoder
for form-url-encoded payloads and aJsonMapper
for JSON payloads. form-url-encoded payloads are first decoded into a Map with keyString
and valueList<String>
. Then, the map is flattened to a Map of keyString
and valueObject>
. If original's map value is a list of 1 item, the item of that list becomes the value of the resulting map.- Parameters:
request
- HTTP Request- Returns:
- a publisher which emits a single item or an empty publisher if the request body cannot be parsed to a Map.
-