diff --git a/lib/inc/drogon/Attribute.h b/lib/inc/drogon/Attribute.h index 33f6e255..1a50f332 100644 --- a/lib/inc/drogon/Attribute.h +++ b/lib/inc/drogon/Attribute.h @@ -22,8 +22,8 @@ namespace drogon { /** - * @brief This class represents a attribute stored in the request context. - * One can get or set any type of data to a attribute object. + * @brief This class represents the attributes stored in the HTTP request. + * One can add/get any type of data to/from an Attributes object. */ class Attributes { @@ -118,9 +118,7 @@ class Attributes /** * @brief Constructor, usually called by the framework */ - Attributes() - { - } + Attributes() = default; private: using AttributesMap = std::map; diff --git a/lib/inc/drogon/HttpRequest.h b/lib/inc/drogon/HttpRequest.h index 0afdcbd2..700e9be4 100644 --- a/lib/inc/drogon/HttpRequest.h +++ b/lib/inc/drogon/HttpRequest.h @@ -229,11 +229,13 @@ class HttpRequest return session(); } - /// Get the attributes store to which the request belongs. - virtual AttributesPtr attributes() const = 0; + /// Get the attributes store, users can add/get any type of data to/from + /// this store + virtual const AttributesPtr &attributes() const = 0; - /// Get the attributes store to which the request belongs. - AttributesPtr getAttributes() const + /// Get the attributes store, users can add/get any type of data to/from + /// this store + const AttributesPtr &getAttributes() const { return attributes(); } diff --git a/lib/src/HttpRequestImpl.h b/lib/src/HttpRequestImpl.h index 52dcb04b..b9562e75 100644 --- a/lib/src/HttpRequestImpl.h +++ b/lib/src/HttpRequestImpl.h @@ -352,7 +352,7 @@ class HttpRequestImpl : public HttpRequest sessionPtr_ = session; } - virtual AttributesPtr attributes() const override + virtual const AttributesPtr &attributes() const override { if (!attributesPtr_) { diff --git a/trantor b/trantor index 312a91e3..ec56d474 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit 312a91e3e9cffa0ce24b4a87b674c64c6470ee96 +Subproject commit ec56d4748d0e29f2369b6d1e9e2b8a4c7bed8892