类的使用
org.springframework.boot.test.web.client.TestRestTemplate
使用TestRestTemplate的程序包
-
org.springframework.boot.test.web.client中TestRestTemplate的使用
修饰符和类型方法说明TestRestTemplate.withBasicAuth
(String username, String password) Creates a newTestRestTemplate
with the same configuration as this one, except that it will send basic authorization headers using the givenusername
andpassword
.TestRestTemplate.withRequestFactorySettings
(UnaryOperator<ClientHttpRequestFactorySettings> requestFactorySettingsCustomizer) Creates a newTestRestTemplate
with the same configuration as this one, except that it will customize theClientHttpRequestFactorySettings
.TestRestTemplate.withRequestFactorySettings
(ClientHttpRequestFactorySettings requestFactorySettings) Creates a newTestRestTemplate
with the same configuration as this one, except that it will apply the givenClientHttpRequestFactorySettings
.