@Override
    public Mono<Void> execute(final ServerWebExchange exchange, final ShenyuPluginChain chain) {
        String domain = exchange.getAttribute(Constants.HTTP_DOMAIN);
        if (StringUtils.isBlank(domain)) {
            return chain.execute(exchange);
        }
        final URI uri = RequestUrlUtils.buildRequestUri(exchange, domain);
        exchange.getAttributes().put(Constants.HTTP_URI, uri);
        return chain.execute(exchange);
    }
@Test
    public void testDoExecute() {
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090?queryParam=Hello,World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        // test https
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("https://localhost");
        when(shenyuContext.getRealUrl()).thenReturn("/test");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("https://localhost/test?queryParam=Hello,World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        // test realUrl
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost");
        when(shenyuContext.getRealUrl()).thenReturn("/test");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost/test?queryParam=Hello,World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        // test rewrite
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090");
        exchange.getAttributes().put(Constants.REWRITE_URI, "/rewrite");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090/rewrite?queryParam=Hello,World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        // test contains % in the row query
        request = MockServerHttpRequest
                .get("localhost")
                .remoteAddress(new InetSocketAddress(8090))
                .queryParam("queryParam", "Hello, World")
                .build();
        this.exchange = spy(MockServerWebExchange.from(request));
        shenyuContext = mock(ShenyuContext.class);
        exchange.getAttributes().put(Constants.CONTEXT, shenyuContext);
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090/query");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090/query?queryParam=Hello%2C%20World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        
        request = MockServerHttpRequest
                .get("localhost")
                .remoteAddress(new InetSocketAddress(8090))
                .queryParam("queryParam", "Hello, World")
                .build();
        this.exchange = spy(MockServerWebExchange.from(request));
        shenyuContext = mock(ShenyuContext.class);
        exchange.getAttributes().put(Constants.CONTEXT, shenyuContext);
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090/%20/query");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090/%20/query?queryParam=Hello%2C%20World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        
        request = MockServerHttpRequest
                .get("localhost")
                .remoteAddress(new InetSocketAddress(8090))
                .queryParam("queryParam", "Hello,  World")
                .build();
        this.exchange = spy(MockServerWebExchange.from(request));
        shenyuContext = mock(ShenyuContext.class);
        exchange.getAttributes().put(Constants.CONTEXT, shenyuContext);
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090/%20/query");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090/%20/query?queryParam=Hello%2C%20%20World", exchange.getAttributes().get(Constants.HTTP_URI).toString());
        
        request = MockServerHttpRequest
                .get("localhost")
                .remoteAddress(new InetSocketAddress(8090))
                .queryParam("p", "a%2Bb=")
                .build();
        this.exchange = spy(MockServerWebExchange.from(request));
        shenyuContext = mock(ShenyuContext.class);
        exchange.getAttributes().put(Constants.CONTEXT, shenyuContext);
        when(exchange.getAttribute(Constants.HTTP_DOMAIN)).thenReturn("http://localhost:8090/query");
        when(chain.execute(exchange)).thenReturn(Mono.empty());
        StepVerifier.create(uriPlugin.execute(exchange, chain)).expectSubscription().verifyComplete();
        assertEquals("http://localhost:8090/query?p=a%252Bb%3D", exchange.getAttributes().get(Constants.HTTP_URI).toString());
    }