diff --git a/src/HttpRouter.h b/src/HttpRouter.h index 175d858..12c7fc1 100644 --- a/src/HttpRouter.h +++ b/src/HttpRouter.h @@ -277,6 +277,9 @@ public: /* Adds the corresponding entires in matching tree and handler list */ void add(std::vector methods, std::string pattern, MoveOnlyFunction &&handler, uint32_t priority = MEDIUM_PRIORITY) { + /* First remove existing handler */ + remove(methods[0], pattern, priority); + for (std::string method : methods) { /* Lookup method */ Node *node = getNode(&root, method, false);