[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.
This commit is contained in:
John Firebaugh
2016-02-03 17:35:06 -08:00
parent cdedb66387
commit 7eb1a91c4e
6 changed files with 15 additions and 29 deletions

View File

@@ -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");