diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-03 17:35:06 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-02-10 15:40:20 -0800 |
commit | 7eb1a91c4e5134ecfbfb91b61a6622be40478af5 (patch) | |
tree | f017137f503ad7ce528b1bcb12f5df35bb319413 /platform/android/src/http_request_android.cpp | |
parent | cdedb66387065680efd318dacb61572c920b81b1 (diff) | |
download | qtlocation-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/android/src/http_request_android.cpp')
-rw-r--r-- | platform/android/src/http_request_android.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/platform/android/src/http_request_android.cpp b/platform/android/src/http_request_android.cpp index 390334627a..105ba5860c 100644 --- a/platform/android/src/http_request_android.cpp +++ b/platform/android/src/http_request_android.cpp @@ -199,17 +199,14 @@ void HTTPAndroidRequest::onResponse(JNIEnv* env, int code, jstring /* message */ response->expires = util::parseTimePoint(mbgl::android::std_string_from_jstring(env, expires).c_str()); } - if (body != nullptr) { - jbyte* bodyData = env->GetByteArrayElements(body, nullptr); - response->data = std::make_shared<std::string>(reinterpret_cast<char*>(bodyData), env->GetArrayLength(body)); - env->ReleaseByteArrayElements(body, bodyData, JNI_ABORT); - } - if (code == 200) { - // Nothing to do; this is what we want + if (body != nullptr) { + jbyte* bodyData = env->GetByteArrayElements(body, nullptr); + response->data = std::make_shared<std::string>(reinterpret_cast<char*>(bodyData), env->GetArrayLength(body)); + env->ReleaseByteArrayElements(body, bodyData, JNI_ABORT); + } } else if (code == 304) { response->notModified = true; - response->data.reset(); } else if (code == 404) { response->error = std::make_unique<Error>(Error::Reason::NotFound, "HTTP status code 404"); } else if (code >= 500 && code < 600) { |