Skip to content

Commit 312f53f

Browse files
authored
GH-1021: Add Request Line override documentation (#1056)
Fixes: #1021 Adding documentation on how to override a target's host through the use of a URI.
1 parent 0769c49 commit 312f53f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@ should work. Feign's default contract defines the following annotations:
109109
| `@HeaderMap` | Parameter | Defines a `Map` of name-value pairs, to expand into `Http Headers` |
110110
| `@Body` | Method | Defines a `Template`, similar to a `UriTemplate` and `HeaderTemplate`, that uses `@Param` annotated values to resolve the corresponding `Expressions`.|
111111

112+
113+
> **Overriding the Request Line**
114+
>
115+
> If there is a need to target a request to a different host then the one supplied when the Feign client was created, or
116+
> you want to supply a target host for each request, include a `java.net.URI` parameter and Feign will use that value
117+
> as the request target.
118+
>
119+
> ```java
120+
> @RequestLine("POST /repos/{owner}/{repo}/issues")
121+
> void createIssue(URI host, Issue issue, @Param("owner") String owner, @Param("repo") String repo);
122+
> ```
123+
>
124+
112125
### Templates and Expressions
113126
114127
Feign `Expressions` represent Simple String Expressions (Level 1) as defined by [URI Template - RFC 6570](https://tools.ietf.org/html/rfc6570). `Expressions` are expanded using

0 commit comments

Comments
 (0)