我在集成測試中使用Spring WebFlux WebTestClient。我使用WebTestClient.bindToServer()
創建客戶端。經測試的服務器通過HTTPS提供資源。我有下面的代碼:禁用WebTestClient的TLS證書檢查
WebTestClient webTestClient = WebTestClient.bindToServer()
.baseUrl("https://secured.example.com")
.build();
webTestClient.get().uri("/index.html")
.exchange()
.expectStatus().isOk();
沒有必要在測試中使用有效證書。我如何配置WebTestClient來信任所有證書?
P.S.我可以配置WebClient來信任每個人。但WebTestClient更適合編寫測試。
你能告訴我們你的配置,這可能有助於回答這個問題嗎?始終包含您擁有的代碼和任何試圖解決問題的嘗試,以便爲我們提供更多背景。關於如何提出好問題的有用資源(以及更快得到解答)https://stackoverflow.com/help/how-to-ask – Moseleyi
其實,我有點困惑。我來自https://spring.io/questions,但似乎這樣的問題並不意味着快速的答案。 –