diff options
-rw-r--r-- | platform/android/src/http_request_android.cpp | 2 | ||||
-rw-r--r-- | platform/darwin/http_request_nsurl.mm | 2 | ||||
-rw-r--r-- | platform/default/http_request_curl.cpp | 2 | ||||
-rw-r--r-- | test/storage/cache_revalidate.cpp | 4 |
4 files changed, 10 insertions, 0 deletions
diff --git a/platform/android/src/http_request_android.cpp b/platform/android/src/http_request_android.cpp index 3458040083..9a554f5281 100644 --- a/platform/android/src/http_request_android.cpp +++ b/platform/android/src/http_request_android.cpp @@ -209,6 +209,8 @@ void HTTPAndroidRequest::onResponse(int code, std::string message, std::string e response->notModified = true; if (existingResponse) { + response->data = existingResponse->data; + if (response->expires == Seconds::zero()) { response->expires = existingResponse->expires; } diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm index a43210cbc0..306cf96293 100644 --- a/platform/darwin/http_request_nsurl.mm +++ b/platform/darwin/http_request_nsurl.mm @@ -229,6 +229,8 @@ void HTTPNSURLRequest::handleResult(NSData *data, NSURLResponse *res, NSError *e response->notModified = true; if (existingResponse) { + response->data = existingResponse->data; + if (response->expires == Seconds::zero()) { response->expires = existingResponse->expires; } diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index 7f95d187cb..5ef8cddb74 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -532,6 +532,8 @@ void HTTPCURLRequest::handleResult(CURLcode code) { response->notModified = true; if (existingResponse) { + response->data = existingResponse->data; + if (response->expires == Seconds::zero()) { response->expires = existingResponse->expires; } diff --git a/test/storage/cache_revalidate.cpp b/test/storage/cache_revalidate.cpp index fc65986a17..a440b69aaf 100644 --- a/test/storage/cache_revalidate.cpp +++ b/test/storage/cache_revalidate.cpp @@ -49,6 +49,8 @@ TEST_F(Storage, CacheRevalidateSame) { EXPECT_EQ(nullptr, res2.error); EXPECT_EQ(false, res2.stale); EXPECT_TRUE(res2.notModified); + ASSERT_TRUE(res2.data.get()); + EXPECT_EQ("Response", *res2.data); EXPECT_LT(Seconds::zero(), res2.expires); EXPECT_EQ(Seconds::zero(), res2.modified); // We're not sending the ETag in the 304 reply, but it should still be there. @@ -107,6 +109,8 @@ TEST_F(Storage, CacheRevalidateModified) { EXPECT_EQ(nullptr, res2.error); EXPECT_EQ(false, res2.stale); EXPECT_TRUE(res2.notModified); + ASSERT_TRUE(res2.data.get()); + EXPECT_EQ("Response", *res2.data); EXPECT_LT(Seconds::zero(), res2.expires); EXPECT_EQ(1420070400, res2.modified.count()); EXPECT_EQ("", res2.etag); |