aboutsummaryrefslogtreecommitdiff
path: root/host/commands/fetcher/curl_wrapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'host/commands/fetcher/curl_wrapper.cc')
-rw-r--r--host/commands/fetcher/curl_wrapper.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/host/commands/fetcher/curl_wrapper.cc b/host/commands/fetcher/curl_wrapper.cc
index c32f4cee3..62af9126a 100644
--- a/host/commands/fetcher/curl_wrapper.cc
+++ b/host/commands/fetcher/curl_wrapper.cc
@@ -24,7 +24,6 @@
#include <curl/curl.h>
#include <json/json.h>
-namespace cuttlefish {
namespace {
size_t file_write_callback(char *ptr, size_t, size_t nmemb, void *userdata) {
@@ -146,16 +145,12 @@ Json::Value CurlWrapper::DownloadToJson(const std::string& url) {
Json::Value CurlWrapper::DownloadToJson(const std::string& url,
const std::vector<std::string>& headers) {
std::string contents = DownloadToString(url, headers);
- Json::CharReaderBuilder builder;
- std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
+ Json::Reader reader;
Json::Value json;
- std::string errorMessage;
- if (!reader->parse(&*contents.begin(), &*contents.end(), &json, &errorMessage)) {
- LOG(ERROR) << "Could not parse json: " << errorMessage;
+ if (!reader.parse(contents, json)) {
+ LOG(ERROR) << "Could not parse json: " << reader.getFormattedErrorMessages();
json["error"] = "Failed to parse json.";
json["response"] = contents;
}
return json;
}
-
-}