summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2019-02-09 19:00:42 +0000
committerMonty Taylor <mordred@inaugust.com>2019-02-09 19:03:20 +0000
commitb50ca80db92535ef0bbfdf6bd63f53a063a3c085 (patch)
treeaf58ec4037be3587a073c6566725d8e1731fa71c
parent9791caef3527c3e1d032ddfee877d30aa393b0eb (diff)
Print out some more specifics
This shows different ways to access things.
-rw-r--r--zuul-preview/main.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/zuul-preview/main.cc b/zuul-preview/main.cc
index f609363..510af7b 100644
--- a/zuul-preview/main.cc
+++ b/zuul-preview/main.cc
@@ -29,7 +29,14 @@ int main(int, char**)
29 auto response = client.request( 29 auto response = client.request(
30 web::http::methods::GET, 30 web::http::methods::GET,
31 "/api/tenant/openstack/build/75031cad206c4014ad7a3387091d15ab").get(); 31 "/api/tenant/openstack/build/75031cad206c4014ad7a3387091d15ab").get();
32 // body is a web::json::value
32 auto body = response.extract_json().get(); 33 auto body = response.extract_json().get();
33 cout << response.status_code() << endl; 34 cout << response.status_code() << endl;
34 cout << body.serialize() << endl; 35 cout << body.serialize() << endl;
36 // body["log_url"] returns a web::json::value
37 cout << "The log url is " << body["log_url"] << endl;
38 // body["log_url"].as_string() returns a const std::string&
39 cout << "The log url is " << body["log_url"].as_string() << endl;
40 // body.at("log_url").as_string() returns a const std::string&
41 cout << "The log url is " << body.at("log_url").as_string() << endl;
35} 42}