summaryrefslogtreecommitdiff
path: root/platform/default/http_request_curl.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-03 17:35:06 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-10 15:40:20 -0800
commit7eb1a91c4e5134ecfbfb91b61a6622be40478af5 (patch)
treef017137f503ad7ce528b1bcb12f5df35bb319413 /platform/default/http_request_curl.cpp
parentcdedb66387065680efd318dacb61572c920b81b1 (diff)
downloadqtlocation-mapboxgl-7eb1a91c4e5134ecfbfb91b61a6622be40478af5.tar.gz
[all] Do not set Response data for 404s
For AssetFileSource and the node FileSource this was already the case; this makes the other implementations consistent.
Diffstat (limited to 'platform/default/http_request_curl.cpp')
-rw-r--r--platform/default/http_request_curl.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp
index f7fb27afc5..660da4c43e 100644
--- a/platform/default/http_request_curl.cpp
+++ b/platform/default/http_request_curl.cpp
@@ -509,19 +509,14 @@ void HTTPCURLRequest::handleResult(CURLcode code) {
long responseCode = 0;
curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &responseCode);
- // Move over any data we got. We're storing this in a separate object because the Response
- // object defines it as const.
- if (data) {
- response->data = std::move(data);
- } else {
- response->data = std::make_shared<std::string>();
- }
-
if (responseCode == 200) {
- // Nothing to do; this is what we want.
+ if (data) {
+ response->data = std::move(data);
+ } else {
+ response->data = std::make_shared<std::string>();
+ }
} else if (responseCode == 304) {
response->notModified = true;
- response->data.reset();
} else if (responseCode == 404) {
response->error =
std::make_unique<Error>(Error::Reason::NotFound, "HTTP status code 404");