springboot使用RestTemplate單元測試時,提示ResourceAccess I/O error on POST request for "http(轉)


springboot使用TestRestTemplate單元測試時,提示ResourceAccess I/O error on POST request for "http

發現如果后台的http狀態碼返回401則會出現這種情況(其他4XX等可能也會)

解決方案,pom.xml加入

 <dependency>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpclient</artifactId>
     <scope>test</scope>
 </dependency>


轉自 https://www.kanzhun.com/jiaocheng/296424.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM