Skip to content

Commit

Permalink
Update ClientHttpRequestInterceptor javadoc
Browse files Browse the repository at this point in the history
Clarify the interceptor is responsible for closing the response
if it throws an exception after receiving it.

Closes gh-29751
  • Loading branch information
rstoyanchev committed Oct 11, 2023
1 parent c7b832c commit 0542fe5
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 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.
Expand All @@ -21,14 +21,10 @@
import org.springframework.http.HttpRequest;

/**
* Intercepts client-side HTTP requests. Implementations of this interface can be
* {@linkplain org.springframework.web.client.RestTemplate#setInterceptors registered}
* with the {@link org.springframework.web.client.RestTemplate RestTemplate},
* as to modify the outgoing {@link ClientHttpRequest} and/or the incoming
* {@link ClientHttpResponse}.
*
* <p>The main entry point for interceptors is
* {@link #intercept(HttpRequest, byte[], ClientHttpRequestExecution)}.
* Contract to intercept client-side HTTP requests. Implementations can be
* registered with {@link org.springframework.web.client.RestClient} or
* {@link org.springframework.web.client.RestTemplate} to modify the outgoing
* request and/or the incoming response.
*
* @author Arjen Poutsma
* @since 3.1
Expand All @@ -55,6 +51,8 @@ public interface ClientHttpRequestInterceptor {
* </ul>
* <li>Optionally wrap the response to filter HTTP attributes.</li>
* </ol>
* <p>Note: if the interceptor throws an exception after receiving a response,
* it must close the response via {@link ClientHttpResponse#close()}.
* @param request the request, containing method, URI, and headers
* @param body the body of the request
* @param execution the request execution
Expand Down

0 comments on commit 0542fe5

Please sign in to comment.