If I do a request that is cached, and I get a 304, Volley is ignoring the cache headers and just using the 304 response ones.
Problem with this is that a header like "Content-Type" will disappear, even though it was in the original request.
iff --git a/src/com/android/volley/toolbox/BasicNetwork.java b/src/com/android/volley/toolbox/BasicNetwork.java
index b3c7d45..1c76919 100644
--- a/src/com/android/volley/toolbox/BasicNetwork.java
+++ b/src/com/android/volley/toolbox/BasicNetwork.java
@@ -86,6 +86,9 @@ public class BasicNetwork implements Network {
HttpResponse httpResponse = null;
byte[] responseContents = null;
Map<String, String> responseHeaders = new HashMap<String, String>();
+ if (request.getCacheEntry() != null) {
+ responseHeaders.putAll(request.getCacheEntry().responseHeaders);
+ }
try {
// Gather headers.
Map<String, String> headers = new HashMap<String, String>();
@@ -94,7 +97,8 @@ public class BasicNetwork implements Network {
StatusLine statusLine = httpResponse.getStatusLine();
int statusCode = statusLine.getStatusCode();
- responseHeaders = convertHeaders(httpResponse.getAllHeaders());
+ responseHeaders.putAll(convertHeaders(httpResponse.getAllHeaders()));
+
// Handle cache validation.
if (statusCode == HttpStatus.SC_NOT_MODIFIED) {
return new NetworkResponse(HttpStatus.SC_NOT_MODIFIED,
Let me know if this is correct.