我正在 Vertx 中编写客户端以发送带有两个字符串参数的 get 请求,但我从服务器接收空列表。如果我向同一路径上的另一个服务写入请求,但该服务未接收任何参数,则响应正常并且数据正确返回。问题在于使用 .addQueryParam 映射服务器端的参数,该参数在服务器端没有很好地映射。有什么帮助吗?
WebClient client = WebClient.create(vertx);
client
.get(80, "localhost", "/mainpath/path1")
.addQueryParam("startDate", "1459926000")
.addQueryParam("endDate", "1459926900")
.send(ar -> {
if (ar.succeeded()) {
HttpResponse<Buffer> response = ar.result();
JsonArray body = response.bodyAsJsonArray();
System.out.println("Received response with status code " + response.statusCode() + " with body " + body.toString());
} else {
System.out.println("Something went wrong " + ar.cause().getMessage());
}
});
}