From c8409dbdf2c41e320c7c24e2d050ff8ff05b3ad9 Mon Sep 17 00:00:00 2001 From: Chunting Gu Date: Thu, 18 Apr 2019 09:49:39 +0800 Subject: [PATCH] Add the missing linkage of jsoncpp to autotest --- autotest/CMakeLists.txt | 2 +- examples/client_basics.cc | 11 +++++++++++ examples/rest_book_client.cc | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/autotest/CMakeLists.txt b/autotest/CMakeLists.txt index e3771ac..1579c84 100644 --- a/autotest/CMakeLists.txt +++ b/autotest/CMakeLists.txt @@ -25,4 +25,4 @@ if(UNIX) endif() add_executable(${AT_TARGET_NAME} ${AT_SRCS}) -target_link_libraries(${AT_TARGET_NAME} webcc gtest ${TEST_LIBS}) +target_link_libraries(${AT_TARGET_NAME} webcc jsoncpp gtest ${TEST_LIBS}) diff --git a/examples/client_basics.cc b/examples/client_basics.cc index 6f7b5e8..6438325 100644 --- a/examples/client_basics.cc +++ b/examples/client_basics.cc @@ -11,6 +11,11 @@ bool kSslVerify = false; bool kSslVerify = true; #endif +static void PrintSeparator() { + static const std::string s_line(80, '-'); + std::cout << s_line << std::endl; +} + int main() { WEBCC_LOG_INIT("", webcc::LOG_CONSOLE); @@ -19,6 +24,8 @@ int main() { session.set_ssl_verify(kSslVerify); try { + PrintSeparator(); + // Using request builder: auto r = session.Request(webcc::HttpRequestBuilder{}.Get(). Url("http://httpbin.org/get"). @@ -29,6 +36,8 @@ int main() { std::cout << r->content() << std::endl; + PrintSeparator(); + // Using shortcut: r = session.Get("http://httpbin.org/get", { "key1", "value1", "key2", "value2" }, @@ -38,6 +47,8 @@ int main() { #if WEBCC_ENABLE_SSL + PrintSeparator(); + // HTTPS support. r = session.Get("https://httpbin.org/get"); diff --git a/examples/rest_book_client.cc b/examples/rest_book_client.cc index f460403..2810694 100644 --- a/examples/rest_book_client.cc +++ b/examples/rest_book_client.cc @@ -169,7 +169,8 @@ public: // ----------------------------------------------------------------------------- void PrintSeparator() { - std::cout << std::string(80, '-') << std::endl; + static const std::string s_line(80, '-'); + std::cout << s_line << std::endl; } void PrintBook(const Book& book) {