mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 11:47:56 +08:00
Add overload function of newHttpResponse (#1646)
This commit is contained in:
parent
269399b701
commit
8e4474bf4c
@ -353,6 +353,9 @@ class DROGON_EXPORT HttpResponse
|
||||
/// Create a normal response with a status code of 200ok and a content type
|
||||
/// of text/html.
|
||||
static HttpResponsePtr newHttpResponse();
|
||||
/// Create a response with a status code and a content type
|
||||
static HttpResponsePtr newHttpResponse(HttpStatusCode code,
|
||||
ContentType type);
|
||||
/// Create a response which returns a 404 page.
|
||||
static HttpResponsePtr newNotFoundResponse();
|
||||
/// Create a response which returns a json object. Its content type is set
|
||||
|
@ -71,6 +71,14 @@ HttpResponsePtr HttpResponse::newHttpResponse()
|
||||
return res;
|
||||
}
|
||||
|
||||
HttpResponsePtr HttpResponse::newHttpResponse(HttpStatusCode code,
|
||||
ContentType type)
|
||||
{
|
||||
auto res = std::make_shared<HttpResponseImpl>(code, type);
|
||||
doResponseCreateAdvices(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
HttpResponsePtr HttpResponse::newHttpJsonResponse(const Json::Value &data)
|
||||
{
|
||||
auto res = std::make_shared<HttpResponseImpl>(k200OK, CT_APPLICATION_JSON);
|
||||
|
Loading…
Reference in New Issue
Block a user