Is your feature request related to a problem? Please describe.
ModifyRequestBodyGatewayFilterFactory only support Class inClass, it is not compatible with generic type.
expected code:
builder.routes()
.route("test_route", r -> r.path("/**").filters(f ->
f.modifyRequestBody(
new ParameterizedTypeReference<MultiValueMap<String, String>>() {},
new ParameterizedTypeReference<MultiValueMap<String, String>>() {},
(RewriteFunction<MultiValueMap<String, String>, MultiValueMap<String, String>>) (exchange, body) -> Mono.just(body))))
Describe the solution you'd like
serverRequest.bodyToMono support both class and ParameterizedTypeReference.
I think ModifyRequestBodyGatewayFilterFactory should support both of them too.
ServerRequest
/**
* Extract the body to a {@code Mono}.
* @param elementClass the class of element in the {@code Mono}
* @param <T> the element type
* @return the body as a mono
*/
<T> Mono<T> bodyToMono(Class<? extends T> elementClass);
/**
* Extract the body to a {@code Mono}.
* @param typeReference a type reference describing the expected response request type
* @param <T> the element type
* @return a mono containing the body of the given type {@code T}
*/
<T> Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference);
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
ModifyRequestBodyGatewayFilterFactory only support
Class inClass, it is not compatible with generic type.expected code:
Describe the solution you'd like
serverRequest.bodyToMono support both class and ParameterizedTypeReference.
I think ModifyRequestBodyGatewayFilterFactory should support both of them too.
ServerRequest
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.