在Spring boot web客户端中发送请求正文时遇到一些问题.try 发送正文,如下所示:
val body = "{\n" +
"\"email\":\"test@mail.com\",\n" +
"\"id\":1\n" +
"}"
val response = webClient.post()
.uri( "test_uri" )
.accept(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromObject(body))
.exchange()
.block()
Its not working. Request body should be in JSON format. Please let me know where I'm doing wrong.