diff options
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/httpclient.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h index edf3bf773..9f08835d3 100644 --- a/src/zenhttp/include/zenhttp/httpclient.h +++ b/src/zenhttp/include/zenhttp/httpclient.h @@ -35,13 +35,18 @@ public: // validate that the content type or content itself makes sense as a string. std::string_view AsText(); - bool IsSuccess() const noexcept; - inline explicit operator bool() const noexcept { return IsSuccess(); } + // Return text representation of the payload. Formats into JSON for structured + // objects, returns text as-is for text types like Text, JSON, HTML etc + std::string ToText(); + + bool IsSuccess() const noexcept; + inline operator bool() const noexcept { return IsSuccess(); } }; [[nodiscard]] Response Put(std::string_view Url, const IoBuffer& Payload); [[nodiscard]] Response Get(std::string_view Url); [[nodiscard]] Response Delete(std::string_view Url); + [[nodiscard]] Response Post(std::string_view Url); [[nodiscard]] Response Post(std::string_view Url, const IoBuffer& Payload); [[nodiscard]] Response Post(std::string_view Url, CbObject Payload); [[nodiscard]] Response Post(std::string_view Url, CbPackage Payload); |