You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/01/10 08:40:08 UTC

[incubator-shenyu] branch master updated: [type: refactor] support websocket query codec. (#2740)

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 d9b163b  [type: refactor] support websocket query codec. (#2740)
d9b163b is described below

commit d9b163b6975765ffbf690bfe92eb14f3cf28beea
Author: Qicz <qi...@gmail.com>
AuthorDate: Mon Jan 10 16:39:59 2022 +0800

    [type: refactor] support websocket query codec. (#2740)
---
 .../java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/shenyu-plugin/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java b/shenyu-plugin/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
index 03db703..9ebed7f 100644
--- a/shenyu-plugin/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
+++ b/shenyu-plugin/shenyu-plugin-websocket/src/main/java/org/apache/shenyu/plugin/websocket/WebSocketPlugin.java
@@ -33,6 +33,7 @@ import org.apache.shenyu.plugin.api.ShenyuPluginChain;
 import org.apache.shenyu.plugin.api.context.ShenyuContext;
 import org.apache.shenyu.plugin.api.result.ShenyuResultEnum;
 import org.apache.shenyu.plugin.api.result.ShenyuResultWrap;
+import org.apache.shenyu.plugin.api.utils.RequestQueryCodecUtil;
 import org.apache.shenyu.plugin.api.utils.WebFluxResultUtils;
 import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
 import org.slf4j.Logger;
@@ -109,9 +110,8 @@ public class WebSocketPlugin extends AbstractShenyuPlugin {
             protocol = "ws://";
         }
         String path = shenyuContext.getMethod();
-        String query = exchange.getRequest().getURI().getQuery();
-        if (StringUtils.hasText(query)) {
-            path = String.join("?", path, query);
+        if (StringUtils.hasText(exchange.getRequest().getURI().getQuery())) {
+            path = String.join("?", path, RequestQueryCodecUtil.getCodecQuery(exchange));
         }
         return protocol + upstream.getUrl() + path;
     }