我正在尝试使用 spring Webflux Webclient 发送国际格式的电话号码,并通过另一个也使用 webflux 的应用程序读取该电话号码。
我的代码如下所示:
webClient = WebClient.builder()
.baseUrl(baseUrl)
.build();
return webClient
.get()
.uri(uriBuilder -> uriBuilder
.path("/endpoint")
.queryParam("phone-number", "+33612345678")
.build()
)
.retrieve()
.bodyToMono(String.class);
Run Code Online (Sandbox Code Playgroud)
不幸的是,在这个调用和接收者之间的某个地方,加号被空格替换了。端点接收:“33612345678”作为字符串。
请求的 netty 调试日志显示了以下内容:
+--------+-------------------------------------------------+----------------+
|00000000| 47 45 54 20 2f 63 75 73 74 6f 6d 65 72 73 3f 70 |GET /endpoint?p|
|00000010| 68 6f 6e 65 2d 6e 75 6d 62 65 72 3d 2b 33 33 36 |hone-number=+336|
|00000020| 31 32 33 34 35 36 37 38 26 6f 6e …Run Code Online (Sandbox Code Playgroud)