Skip to content

Commit d3f7d76

Browse files
authored
Clarify when to use a custom Target or Request Interceptor (#1148)
Fixes #929 Documentation around when to use a Request Interceptor or a custom Target when dealing with specific situations such as setting headers per method or target.
1 parent c084351 commit d3f7d76

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,12 @@ These approaches specify header entries as part of the api and do not require an
642642
when building the Feign client.
643643
644644
#### Setting headers per target
645-
In cases where headers should differ for the same api based on different endpoints or where per-request
646-
customization is required, headers can be set as part of the client using a `RequestInterceptor` or a
647-
`Target`.
645+
To customize headers for each request method on a Target, a RequestInterceptor can be used. RequestInterceptors can be
646+
shared across Target instances and are expected to be thread-safe. RequestInterceptors are applied to all request
647+
methods on a Target.
648+
649+
If you need per method customization, a custom Target is required, as the a RequestInterceptor does not have access to
650+
the current method metadata.
648651
649652
For an example of setting headers using a `RequestInterceptor`, see the `Request Interceptors` section.
650653

0 commit comments

Comments
 (0)