Empty body on HTTP error response
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 8 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
What is the proper REST response code for a valid request but ...
200 Ok should be used when the user gets the resource. Empty is not a resource. 400 range is for client errors 500...
Read more >Should an HTTP API always return a body?
The use case is that the client is expecting valid JSON, even if the response is "empty" or has no content. A good...
Read more >Empty or incomplete HTTPS response body in HTTP client
Sometimes the HTTP Body in an HTTPS response is incomplete when using the OpenEdge HTTP client. Sometimes the last part of an HTTP...
Read more >How can I capture an empty response error, which for my use ...
I make a valid web services call. The expected response has an empty body, but what I need are the headers that are...
Read more >When HttpResponse body is empty it returns a ValueError ...
In checkin 7b846ea the code for httpclient.HttpResponse.body was changed to throw a ValueError when the body is empty. But since the message ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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”?
Same too me , response code = 401 the response body return null, JDK 17, Feign 3.1.4