获取HttpServerRequest中的参数

Ali*_*deh 0 java vert.x

HttpServerRequest在java中使用时io.vertx.core.http,我使用这种方法:

 default String getParam(String paramName) {
    return params().get(paramName);
  }
Run Code Online (Sandbox Code Playgroud)

获取收到请求的参数。当其中一个参数以 开头时+,我的意思是加号,返回值没有+

 var number = request.getParam("number");
Run Code Online (Sandbox Code Playgroud)

有什么解决办法吗?谢谢。

/v1/services?number=+12345
Run Code Online (Sandbox Code Playgroud)

或者

curl --location --request GET 'localhost:8080/v1/services?number=+12345'
 
Run Code Online (Sandbox Code Playgroud)

在此示例中,返回值是 12345,这不是我想要的值。我需要+12345

    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-core</artifactId>
        <version>4.1.1</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

小智 5

+标志必须是URL 编码的

curl --location --request GET 'localhost:8080/v1/services?number=%2B12345'
Run Code Online (Sandbox Code Playgroud)