spring-cloud / spring-cloud-gateway

An API Gateway built on Spring Framework and Spring Boot providing routing and more.
http://cloud.spring.io
Apache License 2.0
4.55k stars 3.33k forks source link

ModifyResponseBodyGatewayFilterFactory always uses default ExchangeStrategy #3554

Open SebastianSchlegel opened 1 month ago

SebastianSchlegel commented 1 month ago

In ModifiedServerHttpResponse.writeWith a new BodyInserterContext() is used which calls the unmodifiable ExchangeStrategies.withDefaults(). This one doesn't use any provided encoder or mapper bean.

I wonder if this is really an issue with the ModifyResponseBodyGatewayFilterFactory or if I'm using it wrong. It could be resolved by adding a new ExchangeStrategyparameter and using BodyInserterContext(exchangeStrategy) then.

https://github.com/spring-cloud/spring-cloud-gateway/blob/fc26a8db9f5d2831b61b71c635b568d28306ae21/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/factory/rewrite/ModifyResponseBodyGatewayFilterFactory.java#L232

spencergibb commented 1 week ago

What is the problem that is happening?

spring-cloud-issues commented 5 hours ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.