fix: fix the ratelimit bug for 2023 (#1316)

pull/1333/head
fredrikliu 5 months ago committed by GitHub
parent 83b05124a6
commit 1672ae7597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -14,3 +14,4 @@
- [fix:fix ApplicationContextAwareUtils NPE bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1297) - [fix:fix ApplicationContextAwareUtils NPE bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1297)
- [feat:upgrade jacoco version.](https://github.com/Tencent/spring-cloud-tencent/pull/1310) - [feat:upgrade jacoco version.](https://github.com/Tencent/spring-cloud-tencent/pull/1310)
- [fix:fix no registry when lossless is disabled.](https://github.com/Tencent/spring-cloud-tencent/pull/1312) - [fix:fix no registry when lossless is disabled.](https://github.com/Tencent/spring-cloud-tencent/pull/1312)
- [fix:fix the ratelimit bug for 2023](https://github.com/Tencent/spring-cloud-tencent/pull/1316)

@ -127,12 +127,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));

@ -119,12 +119,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