This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 07ca9ac9b encode queryParam's key to avoid 400 error when queryParam
is like ?params[name]=123¶ms[sex]=male (#3334)
07ca9ac9b is described below
commit 07ca9ac9ba45dfbbcc74646f9bd2bcc6de68ab0c
Author: vijay <[email protected]>
AuthorDate: Tue Apr 26 15:20:25 2022 +0800
encode queryParam's key to avoid 400 error when queryParam is like
?params[name]=123¶ms[sex]=male (#3334)
Co-authored-by: yuanchongwei <[email protected]>
---
.../org/apache/shenyu/plugin/api/utils/RequestQueryCodecUtil.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/RequestQueryCodecUtil.java
b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/RequestQueryCodecUtil.java
index 3bf85ad94..dc189ec57 100644
---
a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/RequestQueryCodecUtil.java
+++
b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/utils/RequestQueryCodecUtil.java
@@ -48,8 +48,10 @@ public final class RequestQueryCodecUtil {
return queryParams.keySet().stream()
.map(key -> queryParams.get(key).stream()
.map(item -> Optional.ofNullable(item)
- .map(value -> String.join("=", key,
UriUtils.encode(value, StandardCharsets.UTF_8)))
- .orElse(key))
+ .map(value -> String.join("=",
+ UriUtils.encode(key,
StandardCharsets.UTF_8),
+ UriUtils.encode(value,
StandardCharsets.UTF_8)))
+ .orElse(UriUtils.encode(key,
StandardCharsets.UTF_8)))
.filter(StringUtils::isNoneBlank)
.collect(Collectors.joining("&")))
.collect(Collectors.joining("&")).trim();