2
我下一个端点在我的应用程序:如何在Postman中查看Spring 5 Reactive API的响应?
@GetMapping(value = "/users")
public Mono<ServerResponse> users() {
Flux<User> flux = Flux.just(new User("id"));
return ServerResponse.ok()
.contentType(APPLICATION_JSON)
.body(flux, User.class)
.onErrorResume(CustomException.class, e -> ServerResponse.notFound().build());
}
目前我能看到邮差文本"data:"
作为一个机构和Content-Type →text/event-stream
。据我所知Mono<ServerResponse>
总是返回数据SSE(Server Sent Event)
。 是否有可能以某种方式查看Postman客户端中的响应?
嗨,你确定你使用其他消费比邮递员回应? – Seb
@Seb其实我只是在玩代码。在文档中看到这个例子。 –
'Mono'并不总是以SSE形式返回数据。这是WebFlux错误或者你的设置有问题。您可以尝试使用最新的里程碑,还是使用示例项目在jira.spring.io上打开问题? –