mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Avoid using OkHttp3ClientHttpRequestFactory in test
See gh-40611
This commit is contained in:
parent
3b7d4779c4
commit
20042576e9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -94,7 +94,7 @@ class TestRestTemplateTests {
|
||||
|
||||
@Test
|
||||
void useTheSameRequestFactoryClassWithBasicAuth() {
|
||||
OkHttp3ClientHttpRequestFactory customFactory = new OkHttp3ClientHttpRequestFactory();
|
||||
TestClientHttpRequestFactory customFactory = new TestClientHttpRequestFactory();
|
||||
RestTemplateBuilder builder = new RestTemplateBuilder().requestFactory(() -> customFactory);
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate(builder).withBasicAuth("test", "test");
|
||||
RestTemplate restTemplate = testRestTemplate.getRestTemplate();
|
||||
@ -386,4 +386,8 @@ class TestRestTemplateTests {
|
||||
|
||||
}
|
||||
|
||||
static class TestClientHttpRequestFactory extends SimpleClientHttpRequestFactory {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user