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上打開問題? –