Skip to content

Commit 1b89d82

Browse files
Remove route before trying to add it
1 parent 71ec3d3 commit 1b89d82

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/HttpRouter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ struct HttpRouter {
277277

278278
/* Adds the corresponding entires in matching tree and handler list */
279279
void add(std::vector<std::string> methods, std::string pattern, MoveOnlyFunction<bool(HttpRouter *)> &&handler, uint32_t priority = MEDIUM_PRIORITY) {
280+
/* First remove existing handler */
281+
remove(methods[0], pattern, priority);
282+
280283
for (std::string method : methods) {
281284
/* Lookup method */
282285
Node *node = getNode(&root, method, false);

0 commit comments

Comments
 (0)