Handling Http 304 Response In Android

1k views Asked by At

I am using HttpURLConnection for communication with server and using HttpResponseCache for caching, when server respond with 304 (HTTP_NOT_MODIFIED), i got empty body, but according to documentation of HttpURLConnection and HttpResponseCache, in case 304 HttpUrlConnection will fetch the response for the same URL in the cache. While the request for url is cached and i confirmed it. when url is called first time i get proper response (data) while after cached when i called url, Why i am getting empty body (no data).

1

There are 1 answers

0
kashif181 On

I fixed the issue by downloading volley library from official google code repository this is the link https://android.googlesource.com/platform/frameworks/volley/+/master.

Actually the volley source code available at github is customized and cause many issues (github link: https://github.com/mcxiaoke/android-volley), never download from that link.