mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-12 12:25:21 +08:00
Merge pull request #175 from an-tao/dev
Add setBody methods to the HttpRequest class
This commit is contained in:
commit
db3f088cca
@ -106,6 +106,10 @@ class HttpRequest
|
||||
return body();
|
||||
}
|
||||
|
||||
/// Set the content string of the request.
|
||||
virtual void setBody(const std::string &body) = 0;
|
||||
virtual void setBody(std::string &&body) = 0;
|
||||
|
||||
/// Get the path of the request.
|
||||
virtual const std::string &path() const = 0;
|
||||
const std::string &getPath() const
|
||||
|
@ -267,6 +267,16 @@ class HttpRequestImpl : public HttpRequest
|
||||
_content = content;
|
||||
}
|
||||
|
||||
virtual void setBody(const std::string &body) override
|
||||
{
|
||||
_content = body;
|
||||
}
|
||||
|
||||
virtual void setBody(std::string &&body) override
|
||||
{
|
||||
_content = std::move(body);
|
||||
}
|
||||
|
||||
virtual void addHeader(const std::string &key,
|
||||
const std::string &value) override
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user