我通过 WebClient 开发了外部 API,但我不知道如何检查响应正文..
public class Call {
public Mono<Object> get() {
Mono<Object> http = webClient.get()
.uri(EXTERNAL_URL)
.retrieve()
.bodyToMono(Object.class);
return http;
}
}
和测试代码
public class Test {
@Test
void test() {
Call call = new Call();
Mono<Object> mono = call.get();
mono.doOnSuccess(
r -> log.info(">>> r = {}", r) //
).subscribe() }
}
日志内容
>>> r = MonoMap
它只是打印“MonoMap”..我如何检查响应正文?