Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix empty responses when content length is unknown.
For whatever reason, it seems that HttpUrlConnection#getContentLength may return -1 even if the response includes a Content-Length header. This still worked fine in Volley, which only used this header to try to pre-size buffers for reading the response. However, this regressed when we introduced the change to HttpResponse to support byte[] content in addition to InputStream content, as we used the content-length to determine whether content was expected. Resolve this regression by just checking that content was provided (in either form) before returning it, or else returning null, without requiring a valid Content-Length header to be set.
- Loading branch information