fix(path-mapping): Execute path-mapping processor also on response error
Closes gravitee-io/issues#2928
@@ -27,6 +27,7 @@ import io.gravitee.gateway.core.processor.provider.StreamableProcessorProviderCh
import io.gravitee.gateway.handlers.api.processor.cors.CorsSimpleRequestProcessor;
import io.gravitee.gateway.handlers.api.processor.error.SimpleFailureProcessor;
import io.gravitee.gateway.handlers.api.processor.error.templates.ResponseTemplateBasedFailureProcessor;
+import io.gravitee.gateway.handlers.api.processor.pathmapping.PathMappingProcessor;
import java.util.ArrayList;
import java.util.List;
@@ -45,6 +46,11 @@ public class OnErrorProcessorChainFactory extends ApiProcessorChainFactory {
new StreamableProcessorDecorator<>(new CorsSimpleRequestProcessor(api.getProxy().getCors()))));
}
+ if (api.getPathMappings() != null && !api.getPathMappings().isEmpty()) {
+ providers.add(new ProcessorSupplier<>(() ->
+ new StreamableProcessorDecorator<>(new PathMappingProcessor(api.getPathMappings()))));
+ }
+
if (api.getResponseTemplates() != null && ! api.getResponseTemplates().isEmpty()) {
providers.add(new ProcessorSupplier<>(() ->
new StreamableProcessorDecorator<>(new ResponseTemplateBasedFailureProcessor(api.getResponseTemplates()))));
