fix: Set PolicyFailure error code if '0' before write
Fixes
MODIFY
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPolicyFailureWriter.java
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPolicyFailureWriter.java
@@ -74,7 +74,11 @@ public class DefaultPolicyFailureWriter implements IPolicyFailureWriter {
errorCode = 404;
}
- if (failure.getResponseCode() >= 300) {
+ if (failure.getResponseCode() == 0) {
+ // If no response code is set in PolicyFailure, then we can set a default error code to ensure
+ // the body and HTTP response code match.
+ failure.setResponseCode(errorCode);
+ } else if (failure.getResponseCode() >= 300) {
errorCode = failure.getResponseCode();
}

fix: Set PolicyFailure error code if '0' before write

Fixes #1046