Add setBody methods to the HttpRequest class

This commit is contained in:
an-tao 2019-06-11 21:48:16 +08:00
parent bfe7600a10
commit 7c518594d0
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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
{