Open arpitkh12 opened 5 years ago
@ryanjbaxter - Do you have any updates on this. I have been researching through the gateway documents but found no solution.
There's not a way to use read body via yaml
@spencergibb - I know we cannot use read body via yaml. So is their a way to convert the above yaml to Java DSL ? Alternatively what is the other way to read request body in global filters without ReadBodyPredicateFactory
.
It is kind of ugly at the moment.
You would have to provide your own DiscoveryClientRouteDefinitionLocator
bean and mark it as @Primary
. In that bean you would have to write some code to add the read body predicate.
We should make this easier. Maybe by providing a list of predicate and filter beans we would automatically include?
We could probably make readBody()
work with a SpEL expression that would work via yaml.
Any other way we can read the request body in GlobalFilter
?
My requirement is to make a call to an audit microservice which requires the request body ? So using rest template to make the call before proceeding to actual call but need to pass requestbody
to it along with some other parameters.
It is kind of ugly at the moment.
You would have to provide your own
DiscoveryClientRouteDefinitionLocator
bean and mark it as@Primary
. In that bean you would have to write some code to add the read body predicate.We should make this easier. Maybe by providing a list of predicate and filter beans we would automatically include?
Can you please provide an example on how to implement custom DiscoveryClientRouteDefinitionLocator
bean with the read body predicate.
Need to add service registered with Eureka server as routes dynamically to spring cloud gateway. Have got it working using
Can someone help me in converting this to Java Code? Need to do this to use readBody() which we cannot do in yaml files as per https://github.com/spring-cloud/spring-cloud-gateway/issues/690