From 1b89d82cb0b6b851fd565f4a43a8d5ec3efe908d Mon Sep 17 00:00:00 2001 From: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> Date: Sat, 23 Dec 2023 15:27:44 +0100 Subject: [PATCH] Remove route before trying to add it --- src/HttpRouter.h | 3 +++ 1 file changed, 3 insertions(+) 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);