Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit d6b9c34

Browse files
Resolves null iteration bug in route lookup
1 parent 8a33c0a commit d6b9c34

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Package.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name = "[email protected]/reno"
22
description = "A thin routing library designed to sit on top of Deno's standard HTTP module"
3-
version = "0.6.3"
3+
version = "0.6.4"

reno/router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const routerCreator = (
6969
const queryParams = rootQueryParams || url.searchParams;
7070

7171
for (let [path, handler] of routes) {
72-
const [firstMatch, ...restMatches] = url.pathname.match(pathParser(path));
72+
const [firstMatch, ...restMatches] = url.pathname.match(pathParser(path)) || [];
7373

7474
if (firstMatch) {
7575
const res = await handler(

reno/router_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ test({
9090
async fn() {
9191
const mismatchedRequest = await createServerRequest({ path: "/foo-bar" });
9292
const routeStub = sinon.stub();
93-
const createRouter = routerCreator(sinon.stub(), sinon.stub());
93+
const createRouter = routerCreator(parsePath, sinon.stub());
9494
const router = createRouter(createRouteMap([[/^\/foo$/, routeStub]]));
9595

9696
await router(mismatchedRequest)

0 commit comments

Comments
 (0)