Remove route before trying to add it

This commit is contained in:
uNetworkingAB
2023-12-23 15:27:44 +01:00
committed by GitHub
parent 71ec3d34c1
commit 1b89d82cb0
+3
View File
@@ -277,6 +277,9 @@ public:
/* Adds the corresponding entires in matching tree and handler list */
void add(std::vector<std::string> methods, std::string pattern, MoveOnlyFunction<bool(HttpRouter *)> &&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);