diff --git a/changelog/1.3.0.md b/changelog/1.3.0.md index 8aa2747a..3330b2be 100644 --- a/changelog/1.3.0.md +++ b/changelog/1.3.0.md @@ -9,9 +9,11 @@ Contents: - [The New oatpp::String](#the-new-oatppstring) - [ConnectionPool::get() Timeout](#connectionpoolget-timeout) - [JSON Serializer Escape Flags](#json-serializer-escape-flags) +- [Response::getBody()](#responsegetbody) - [data::stream::FIFOStream](#datastreamfifostream) - [data::stream::BufferedInputStream](#datastreambufferedinputstream) + ## The New oatpp::String Now it's much easier to use `oatpp::String` since `oatpp::String` is now wrapper over `std::string` @@ -119,6 +121,11 @@ 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. + + ## data::stream::FIFOStream The new `FIFOStream` stream is a buffered @@ -133,6 +140,7 @@ buffered in a single stream. However, it is not synchronized, so be careful when using `FIFOStream` in a multithreaded manner. You need to implement your own locking. + ## data::stream::BufferedInputStream `FIFOStream` also introduced a new interface 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;.