diff --git a/examples/simple_example/JsonTestController.cc b/examples/simple_example/JsonTestController.cc index 50a43683..3b1dd898 100644 --- a/examples/simple_example/JsonTestController.cc +++ b/examples/simple_example/JsonTestController.cc @@ -17,5 +17,6 @@ void JsonTestController::asyncHandleHttpRequest( } json["rows"] = array; auto resp = HttpResponse::newHttpJsonResponse(json); + assert(resp->jsonObject().get()); callback(resp); } diff --git a/lib/src/HttpResponseImpl.cc b/lib/src/HttpResponseImpl.cc index 9cd53cb3..b5c1ac08 100644 --- a/lib/src/HttpResponseImpl.cc +++ b/lib/src/HttpResponseImpl.cc @@ -679,6 +679,10 @@ void HttpResponseImpl::parseJson() const jsonPtr_.reset(); } } + else + { + jsonPtr_.reset(); + } } HttpResponseImpl::~HttpResponseImpl() diff --git a/lib/src/HttpResponseImpl.h b/lib/src/HttpResponseImpl.h index 268f36b7..01f95de3 100644 --- a/lib/src/HttpResponseImpl.h +++ b/lib/src/HttpResponseImpl.h @@ -304,10 +304,12 @@ class HttpResponseImpl : public HttpResponse } void setJsonObject(const Json::Value &pJson) { + flagForParsingJson_ = true; jsonPtr_ = std::make_shared(pJson); } void setJsonObject(Json::Value &&pJson) { + flagForParsingJson_ = true; jsonPtr_ = std::make_shared(std::move(pJson)); } void generateBodyFromJson(); diff --git a/trantor b/trantor index b46138e0..4eee8e12 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit b46138e0cd281bc42f061bf9c51755e96ad9f3f6 +Subproject commit 4eee8e12def354cbd9745e80a917fd9e71aecb85