feign: Empty body on HTTP error response
I had a problem where the response body would come up empty, when the server responded with 401:
2015-08-31 17:11:01.168 [MyInterface#myMethod] <--- HTTP/1.1 401 Unauthorized (12ms)
2015-08-31 17:11:01.169 [MyInterface#myMethod] Date: Mon, 31 Aug 2015 15:11:01 GMT
2015-08-31 17:11:01.169 [MyInterface#myMethod] Content-Length: 71
2015-08-31 17:11:01.170 [MyInterface#myMethod] Content-Type: application/json
2015-08-31 17:11:01.170 [MyInterface#myMethod] <--- END HTTP (0-byte body)
As indicated by content-length header, the body should be 71 bytes, and it is (verified with tcpdump). The empty body caused a NPE when the ErrorDecoder had nothing to decode and returned null, which SynchronousMethodHandler then tried to throw (line 121).
During previous testing, with 200 OK it worked fine, if I recall correct.
This was with the Default client. Using OkHttpClient instead, the issue disappeared.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (10 by maintainers)
Commits related to this issue
- Configurable to disable streaming mode for Default client * Add a property `allowStramingMode` in `Request.Option`. * Optional to disable the streaming mode for `HttpURLConnection`. * The property ... — committed to verils/feign by verils 4 years ago
- Configurable to disable streaming mode for Default client * Add a property `allowStramingMode` in `Request.Option`. * Optional to disable the streaming mode for `HttpURLConnection`. * The property ... — committed to verils/feign by verils 4 years ago
- Configurable to disable streaming mode for Default client (#1182) * Configurable to disable streaming mode for Default client * Add a property `allowStramingMode` in `Request.Option`. * Optiona... — committed to OpenFeign/feign by velo 4 years ago
Same too me , response code = 401 the response body return null, JDK 17, Feign 3.1.4
Unfortunately this ‘feature’ has remained to JDK 11. I just tested
@344310362 english comments are more likely to be understood by most of the people following this project.
Google translate isn’t very good here as it turns that into:
Perhaps a better translation of “death” would be “null”?
这个修复啥时候发布,怎么就把参数定死了。