File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed
httpclient/src/main/java/feign/httpclient
okhttp/src/main/java/feign/okhttp Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,11 @@ public interface Body extends Closeable {
221
221
* It is the responsibility of the caller to close the stream.
222
222
*/
223
223
Reader asReader () throws IOException ;
224
+
225
+ /**
226
+ *
227
+ */
228
+ Reader asReader (Charset charset ) throws IOException ;
224
229
}
225
230
226
231
private static final class InputStreamBody implements Response .Body {
@@ -260,6 +265,12 @@ public Reader asReader() throws IOException {
260
265
return new InputStreamReader (inputStream , UTF_8 );
261
266
}
262
267
268
+ @ Override
269
+ public Reader asReader (Charset charset ) throws IOException {
270
+ checkNotNull (charset , "charset should not be null" );
271
+ return new InputStreamReader (inputStream , charset );
272
+ }
273
+
263
274
@ Override
264
275
public void close () throws IOException {
265
276
inputStream .close ();
@@ -309,6 +320,12 @@ public Reader asReader() throws IOException {
309
320
return new InputStreamReader (asInputStream (), UTF_8 );
310
321
}
311
322
323
+ @ Override
324
+ public Reader asReader (Charset charset ) throws IOException {
325
+ checkNotNull (charset , "charset should not be null" );
326
+ return new InputStreamReader (asInputStream (), charset );
327
+ }
328
+
312
329
@ Override
313
330
public void close () throws IOException {}
314
331
Original file line number Diff line number Diff line change 21
21
import java .io .IOException ;
22
22
import java .io .InputStream ;
23
23
import java .io .Reader ;
24
+ import java .nio .charset .Charset ;
24
25
import java .lang .reflect .InvocationHandler ;
25
26
import java .lang .reflect .Method ;
26
27
import java .lang .reflect .Type ;
@@ -399,6 +400,11 @@ public Reader asReader() throws IOException {
399
400
return original .body ().asReader ();
400
401
}
401
402
403
+ @ Override
404
+ public Reader asReader (Charset charset ) throws IOException {
405
+ return original .body ().asReader (charset );
406
+ }
407
+
402
408
@ Override
403
409
public void close () throws IOException {
404
410
closed .set (true );
Original file line number Diff line number Diff line change 34
34
import java .io .InputStream ;
35
35
import java .io .InputStreamReader ;
36
36
import java .io .Reader ;
37
+ import java .nio .charset .Charset ;
37
38
import java .io .UnsupportedEncodingException ;
38
39
import java .net .MalformedURLException ;
39
40
import java .net .URI ;
52
53
/**
53
54
* This module directs Feign's http requests to Apache's
54
55
* <a href="https://hc.apache.org/httpcomponents-client-ga/">HttpClient</a>. Ex.
55
- *
56
+ *
56
57
* <pre>
57
58
* GitHub github = Feign.builder().client(new ApacheHttpClient()).target(GitHub.class,
58
59
* "https://api.github.com");
@@ -224,6 +225,12 @@ public Reader asReader() throws IOException {
224
225
return new InputStreamReader (asInputStream (), UTF_8 );
225
226
}
226
227
228
+ @ Override
229
+ public Reader asReader (Charset charset ) throws IOException {
230
+ Util .checkNotNull (charset , "charset should not be null" );
231
+ return new InputStreamReader (asInputStream (), charset );
232
+ }
233
+
227
234
@ Override
228
235
public void close () throws IOException {
229
236
EntityUtils .consume (entity );
Original file line number Diff line number Diff line change 22
22
import java .io .IOException ;
23
23
import java .io .InputStream ;
24
24
import java .io .Reader ;
25
+ import java .nio .charset .Charset ;
25
26
import java .util .Collection ;
26
27
import java .util .Map ;
27
28
import java .util .concurrent .TimeUnit ;
@@ -142,6 +143,11 @@ public InputStream asInputStream() throws IOException {
142
143
public Reader asReader () throws IOException {
143
144
return input .charStream ();
144
145
}
146
+
147
+ @ Override
148
+ public Reader asReader (Charset charset ) throws IOException {
149
+ return asReader ();
150
+ }
145
151
};
146
152
}
147
153
You can’t perform that action at this time.
0 commit comments