You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support binary request/response bodies (OpenFeign#57)
Request/Response/RequestTemplate are now fundamentally based on a byte[] body field.
For Request/RequestTemplate, if a charset is provided, it can be treated as text.
For many users of the library, the change should barely be noticeable, as the methods that
were changed were mostly used internally.
There were some non-backwards-compatible signature changes that require a
major version bump, however.
Copy file name to clipboardExpand all lines: README.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,16 +144,29 @@ MyService api = Feign.create(MyService.class, "https://myAppProd", new RibbonMod
144
144
### Decoders
145
145
`Feign.builder()` allows you to specify additional configuration such as how to decode a response.
146
146
147
-
If any methods in your interface return types besides `Response`, `String`or `void`, you'll need to configure a `Decoder`.
147
+
If any methods in your interface return types besides `Response`, `String`, `byte[]`or `void`, you'll need to configure a non-default`Decoder`.
148
148
149
-
Here's how to configure json decoding (using the `feign-gson` extension):
149
+
Here's how to configure JSON decoding (using the `feign-gson` extension):
150
150
151
151
```java
152
152
GitHub github =Feign.builder()
153
153
.decoder(newGsonDecoder())
154
154
.target(GitHub.class, "https://api.github.com");
155
155
```
156
156
157
+
### Encoders
158
+
`Feign.builder()` allows you to specify additional configuration such as how to encode a request.
159
+
160
+
If any methods in your interface use parameters types besides `String` or `byte[]`, you'll need to configure a non-default `Encoder`.
161
+
162
+
Here's how to configure JSON encoding (using the `feign-gson` extension):
163
+
164
+
```json
165
+
GitHub github = Feign.builder()
166
+
.encoder(new GsonEncoder())
167
+
.target(GitHub.class, "https://api.github.com");
168
+
```
169
+
157
170
### Advanced usage and Dagger
158
171
#### Dagger
159
172
Feign can be directly wired into Dagger which keeps things at compile time and Android friendly. As opposed to exposing builders for config, Feign intends users to embed their config in Dagger.
0 commit comments