Ali Hosseinzadeh
Ali Hosseinzadeh

Reputation: 162

Get parameters in HttpServerRequest

While using HttpServerRequest in io.vertx.core.http java, I use this method:

 default String getParam(String paramName) {
    return params().get(paramName);
  }

to get the params of the received request. When one of the parameters begins with +, I mean plus sign, the returned value does not have + .

 var number = request.getParam("number");

Any solution? thanks.

/v1/services?number=+12345

or

curl --location --request GET 'localhost:8080/v1/services?number=+12345'
 

in this example, the returned value is 12345 which is not my desired one. I need +12345

    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-core</artifactId>
        <version>4.1.1</version>
    </dependency>

Upvotes: 1

Views: 213

Answers (1)

artild
artild

Reputation: 390

+ sign must be URL-encoded:

curl --location --request GET 'localhost:8080/v1/services?number=%2B12345'

Upvotes: 5

Related Questions