Fix a bug when creating json responses (#373)
This commit is contained in:
parent
686e30b250
commit
49d1697bec
|
@ -17,5 +17,6 @@ void JsonTestController::asyncHandleHttpRequest(
|
|||
}
|
||||
json["rows"] = array;
|
||||
auto resp = HttpResponse::newHttpJsonResponse(json);
|
||||
assert(resp->jsonObject().get());
|
||||
callback(resp);
|
||||
}
|
||||
|
|
|
@ -679,6 +679,10 @@ void HttpResponseImpl::parseJson() const
|
|||
jsonPtr_.reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonPtr_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
HttpResponseImpl::~HttpResponseImpl()
|
||||
|
|
|
@ -304,10 +304,12 @@ class HttpResponseImpl : public HttpResponse
|
|||
}
|
||||
void setJsonObject(const Json::Value &pJson)
|
||||
{
|
||||
flagForParsingJson_ = true;
|
||||
jsonPtr_ = std::make_shared<Json::Value>(pJson);
|
||||
}
|
||||
void setJsonObject(Json::Value &&pJson)
|
||||
{
|
||||
flagForParsingJson_ = true;
|
||||
jsonPtr_ = std::make_shared<Json::Value>(std::move(pJson));
|
||||
}
|
||||
void generateBodyFromJson();
|
||||
|
|
2
trantor
2
trantor
|
@ -1 +1 @@
|
|||
Subproject commit b46138e0cd281bc42f061bf9c51755e96ad9f3f6
|
||||
Subproject commit 4eee8e12def354cbd9745e80a917fd9e71aecb85
|
Loading…
Reference in New Issue