1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
import org .springframework .http .HttpRequest ;
22
22
23
23
/**
24
- * Intercepts client-side HTTP requests. Implementations of this interface can be
25
- * {@linkplain org.springframework.web.client.RestTemplate#setInterceptors registered}
26
- * with the {@link org.springframework.web.client.RestTemplate RestTemplate},
27
- * as to modify the outgoing {@link ClientHttpRequest} and/or the incoming
28
- * {@link ClientHttpResponse}.
29
- *
30
- * <p>The main entry point for interceptors is
31
- * {@link #intercept(HttpRequest, byte[], ClientHttpRequestExecution)}.
24
+ * Contract to intercept client-side HTTP requests. Implementations can be
25
+ * registered with {@link org.springframework.web.client.RestClient} or
26
+ * {@link org.springframework.web.client.RestTemplate} to modify the outgoing
27
+ * request and/or the incoming response.
32
28
*
33
29
* @author Arjen Poutsma
34
30
* @since 3.1
@@ -55,6 +51,8 @@ public interface ClientHttpRequestInterceptor {
55
51
* </ul>
56
52
* <li>Optionally wrap the response to filter HTTP attributes.</li>
57
53
* </ol>
54
+ * <p>Note: if the interceptor throws an exception after receiving a response,
55
+ * it must close the response via {@link ClientHttpResponse#close()}.
58
56
* @param request the request, containing method, URI, and headers
59
57
* @param body the body of the request
60
58
* @param execution the request execution
0 commit comments