From ffe8d1e8f44327c016868e40dbefacd502111c2f Mon Sep 17 00:00:00 2001 From: slaff Date: Wed, 17 Nov 2021 09:49:42 +0100 Subject: [PATCH] Allow registering of plugins for HttpResource based classes. (#2427) --- .../Network/src/Network/Http/HttpResourceTree.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sming/Components/Network/src/Network/Http/HttpResourceTree.h b/Sming/Components/Network/src/Network/Http/HttpResourceTree.h index fb7aee3370..699396e35d 100644 --- a/Sming/Components/Network/src/Network/Http/HttpResourceTree.h +++ b/Sming/Components/Network/src/Network/Http/HttpResourceTree.h @@ -59,6 +59,15 @@ class HttpResourceTree : public ObjectMap using ObjectMap::set; + template + HttpResource* set(const String& path, HttpResource* resource, HttpResourcePlugin* plugin, Tail... plugins) + { + registerPlugin(plugin, plugins...); + set(path, resource); + resource->addPlugin(plugin, plugins...); + return resource; + } + /** * @brief Set a callback to handle the given path * @param path URL path