From f9dc17ae1fb1394f5763de7cbf919ec55f6a6345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt-Alexander=20Mokro=C3=9F?= Date: Tue, 17 Aug 2021 14:05:14 +0200 Subject: [PATCH 1/2] Added getter for `m_body` of `Response` --- src/oatpp/web/protocol/http/outgoing/Response.cpp | 4 ++++ src/oatpp/web/protocol/http/outgoing/Response.hpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/oatpp/web/protocol/http/outgoing/Response.cpp b/src/oatpp/web/protocol/http/outgoing/Response.cpp index 7d3da28f..1d6639a1 100644 --- a/src/oatpp/web/protocol/http/outgoing/Response.cpp +++ b/src/oatpp/web/protocol/http/outgoing/Response.cpp @@ -48,6 +48,10 @@ protocol::http::Headers& Response::getHeaders() { return m_headers; } +std::shared_ptr Response::getBody() const { + return m_body; +} + void Response::putHeader(const oatpp::String& key, const oatpp::String& value) { m_headers.put(key, value); } diff --git a/src/oatpp/web/protocol/http/outgoing/Response.hpp b/src/oatpp/web/protocol/http/outgoing/Response.hpp index ad4a45bd..9deddfe9 100644 --- a/src/oatpp/web/protocol/http/outgoing/Response.hpp +++ b/src/oatpp/web/protocol/http/outgoing/Response.hpp @@ -89,6 +89,12 @@ public: */ Headers& getHeaders(); + /** + * Get body + * @return - &id:oatpp::web::protocol::http::outgoing::Body; + */ + std::shared_ptr getBody() const; + /** * Add http header. * @param key - &id:oatpp::String;. From d4b301a8188df65bb725cf8872e3bc6344f07e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt-Alexander=20Mokro=C3=9F?= Date: Tue, 17 Aug 2021 16:42:44 +0200 Subject: [PATCH 2/2] Update 1.3.0.md Added note about Response::getBody() --- changelog/1.3.0.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog/1.3.0.md b/changelog/1.3.0.md index cb37f063..1802b58a 100644 --- a/changelog/1.3.0.md +++ b/changelog/1.3.0.md @@ -9,7 +9,7 @@ Contents: - [The New oatpp::String](#the-new-oatppstring) - [ConnectionPool::get() Timeout](#connectionpoolget-timeout) - [JSON Serializer Escape Flags](#json-serializer-escape-flags) - +- [Response::getBody()](#responsegetbody) ## The New oatpp::String @@ -118,3 +118,6 @@ Output: res='"https://oatpp.io/"' # solidus isn't escaped ``` +## Response::getBody() + +`oatpp::web::protocol::http::outgoing::Response` has a new method `getBody()` to retreive the body of the response. This is handy for response interceptors.