mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 03:38:03 +08:00
Add setBody methods to the HttpRequest class
This commit is contained in:
parent
bfe7600a10
commit
7c518594d0
@ -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