11/*
2- * Copyright 2002-2018 the original author or authors.
2+ * Copyright 2002-2023 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2121import org .springframework .http .HttpRequest ;
2222
2323/**
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.
3228 *
3329 * @author Arjen Poutsma
3430 * @since 3.1
@@ -55,6 +51,8 @@ public interface ClientHttpRequestInterceptor {
5551 * </ul>
5652 * <li>Optionally wrap the response to filter HTTP attributes.</li>
5753 * </ol>
54+ * <p>Note: if the interceptor throws an exception after receiving a response,
55+ * it must close the response via {@link ClientHttpResponse#close()}.
5856 * @param request the request, containing method, URI, and headers
5957 * @param body the body of the request
6058 * @param execution the request execution
0 commit comments