add getActiveRuleName

pull/1300/head
fredrikliu 1 year ago
parent 556635386a
commit 25b20d2126

@ -128,12 +128,12 @@ public class QuotaCheckReactiveFilter implements WebFilter, Ordered {
if (Objects.nonNull(quotaResponse.getActiveRule())) { if (Objects.nonNull(quotaResponse.getActiveRule())) {
try { try {
String encodedActiveRuleName = URLEncoder.encode( String encodedActiveRuleName = URLEncoder.encode(
quotaResponse.getActiveRule().getName().getValue(), UTF_8); quotaResponse.getActiveRuleName(), UTF_8);
response.getHeaders().add(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName); response.getHeaders().add(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName);
} }
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
LOG.error("Cannot encode {} for header internal-callee-activerule.", LOG.error("Cannot encode {} for header internal-callee-activerule.",
quotaResponse.getActiveRule().getName().getValue(), e); quotaResponse.getActiveRuleName(), e);
} }
} }
return response.writeWith(Mono.just(dataBuffer)); return response.writeWith(Mono.just(dataBuffer));

@ -121,12 +121,12 @@ public class QuotaCheckServletFilter extends OncePerRequestFilter {
if (Objects.nonNull(quotaResponse.getActiveRule())) { if (Objects.nonNull(quotaResponse.getActiveRule())) {
try { try {
String encodedActiveRuleName = URLEncoder.encode( String encodedActiveRuleName = URLEncoder.encode(
quotaResponse.getActiveRule().getName().getValue(), UTF_8); quotaResponse.getActiveRuleName(), UTF_8);
response.addHeader(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName); response.addHeader(HeaderConstant.INTERNAL_ACTIVE_RULE_NAME, encodedActiveRuleName);
} }
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
LOG.error("Cannot encode {} for header internal-callee-activerule.", LOG.error("Cannot encode {} for header internal-callee-activerule.",
quotaResponse.getActiveRule().getName().getValue(), e); quotaResponse.getActiveRuleName(), e);
} }
} }
return; return;

Loading…
Cancel
Save