diff --git a/README.md b/README.md index fb40f69c..bd441456 100755 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ void TestCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req, } ``` -**Don't be scared by the code, most of the above programs can be automatically generated by the command line tool `drogon_ctl` provided by drogon**. All the user needs to do is add their own business logic. In the example, the controller returns a `Hello, world!` string when the client accesses the `http://ip/test` URL. +**Most of the above programs can be automatically generated by the command line tool `drogon_ctl` provided by drogon** (The cammand is `drogon_ctl create controller TestCtrl`). All the user needs to do is add their own business logic. In the example, the controller returns a `Hello, world!` string when the client accesses the `http://ip/test` URL. For JSON format response, we create the controller as follows: diff --git a/drogon.jpg b/drogon.jpg index b9bff69f..35cfca75 100644 Binary files a/drogon.jpg and b/drogon.jpg differ diff --git a/examples/simple_example_test/main.cc b/examples/simple_example_test/main.cc index 94e1886a..9f134fdd 100644 --- a/examples/simple_example_test/main.cc +++ b/examples/simple_example_test/main.cc @@ -26,6 +26,7 @@ #define RED "\033[31m" /* Red */ #define GREEN "\033[32m" /* Green */ +#define JPG_LEN 44618 using namespace drogon; void outputGood(const HttpRequestPtr &req, bool isHttps) @@ -460,7 +461,7 @@ void doTest(const HttpClientPtr &client, std::promise &pro, bool isHttps = client->sendRequest(req, [=, &pro](ReqResult result, const HttpResponsePtr &resp) { if (result == ReqResult::Ok) { - if (resp->getBody().length() == 52594) + if (resp->getBody().length() == JPG_LEN) { outputGood(req, isHttps); auto lastModified = resp->getHeader("last-modified"); @@ -566,7 +567,7 @@ void doTest(const HttpClientPtr &client, std::promise &pro, bool isHttps = client->sendRequest(req, [=](ReqResult result, const HttpResponsePtr &resp) { if (result == ReqResult::Ok) { - if (resp->getBody().length() == 52594) + if (resp->getBody().length() == JPG_LEN) { outputGood(req, isHttps); }