|  | 
| 39 | 39 | import okhttp3.mockwebserver.MockWebServer; | 
| 40 | 40 | import okhttp3.mockwebserver.RecordedRequest; | 
| 41 | 41 | import okio.Buffer; | 
|  | 42 | +import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder; | 
| 42 | 43 | import org.junit.jupiter.api.AfterEach; | 
| 43 | 44 | import org.junit.jupiter.api.BeforeEach; | 
| 44 | 45 | import org.junit.jupiter.api.Named; | 
|  | 46 | +import org.junit.jupiter.api.Test; | 
| 45 | 47 | import org.junit.jupiter.params.ParameterizedTest; | 
| 46 | 48 | import org.junit.jupiter.params.provider.Arguments; | 
| 47 | 49 | import org.junit.jupiter.params.provider.MethodSource; | 
|  | 
| 64 | 66 |  * Tests for {@link ClientHttpConnector} implementations. | 
| 65 | 67 |  * @author Arjen Poutsma | 
| 66 | 68 |  * @author Brian Clozel | 
|  | 69 | + * @author Sebastien Deleuze | 
| 67 | 70 |  */ | 
| 68 | 71 | class ClientHttpConnectorTests { | 
| 69 | 72 | 
 | 
| @@ -198,6 +201,28 @@ void cookieExpireValueSetAsMaxAge(ClientHttpConnector connector) { | 
| 198 | 201 | 				.verifyComplete(); | 
| 199 | 202 | 	} | 
| 200 | 203 | 
 | 
|  | 204 | +	@Test | 
|  | 205 | +	void disableCookieWithHttpComponents() { | 
|  | 206 | +		ClientHttpConnector connector = new HttpComponentsClientHttpConnector( | 
|  | 207 | +				HttpAsyncClientBuilder.create().disableCookieManagement().build() | 
|  | 208 | +		); | 
|  | 209 | + | 
|  | 210 | +		prepareResponse(response -> { | 
|  | 211 | +			response.setResponseCode(200); | 
|  | 212 | +			response.addHeader("Set-Cookie", "id=test;"); | 
|  | 213 | +		}); | 
|  | 214 | +		Mono<ClientHttpResponse> futureResponse = | 
|  | 215 | +				connector.connect(HttpMethod.GET, this.server.url("/").uri(), ReactiveHttpOutputMessage::setComplete); | 
|  | 216 | +		StepVerifier.create(futureResponse) | 
|  | 217 | +				.assertNext(response -> { | 
|  | 218 | +							assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); | 
|  | 219 | +							assertThat(response.getCookies()).isEmpty(); | 
|  | 220 | +						} | 
|  | 221 | +				) | 
|  | 222 | +				.verifyComplete(); | 
|  | 223 | + | 
|  | 224 | +	} | 
|  | 225 | + | 
| 201 | 226 | 	private Buffer randomBody(int size) { | 
| 202 | 227 | 		Buffer responseBody = new Buffer(); | 
| 203 | 228 | 		Random rnd = new Random(); | 
|  | 
0 commit comments