summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hero.mjs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hero.mjs b/src/hero.mjs
index daf8141..10fa06e 100644
--- a/src/hero.mjs
+++ b/src/hero.mjs
@@ -172,12 +172,17 @@ export const addRoute = (table, methods, path, handlerFn) => {
return addRoute(table, [methods], path, handlerFn);
}
- assert.ok(methods.every(m => HTTP_METHODS.has(m)));
+ assert.ok(methods.every(isValidLabel));
const segments = pathToSegments(path);
const kw = hasPathParams(segments) ? "dynamic" : "static";
return methods.reduce(
- (acc, el) => u.assocIn(acc, [kw, el].concat(segments), handlerFn),
+ (acc, el) =>
+ u.assocIn(
+ acc,
+ comboForLabel(el, kw).concat(segments),
+ handlerFn,
+ ),
table,
);
};