Skip to content

Commit

Permalink
Allow registering of plugins for HttpResource based classes. (#2427)
Browse files Browse the repository at this point in the history
  • Loading branch information
slaff authored Nov 17, 2021
1 parent 06be6bb commit ffe8d1e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sming/Components/Network/src/Network/Http/HttpResourceTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ class HttpResourceTree : public ObjectMap<String, HttpResource>

using ObjectMap::set;

template <class... Tail>
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
Expand Down

0 comments on commit ffe8d1e

Please sign in to comment.