Skip to content

Commit fe36cd6

Browse files
committed
fix: impossible to reach '/'
1 parent 4773e66 commit fe36cd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/webfunc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ const serveHttpEndpoints = (endpoints, appconfig) => {
286286
const httpEndpoint = ((req._parsedUrl || {}).pathname || '/').toLowerCase()
287287
const httpMethod = (req.method || '').toUpperCase()
288288
const endpoint = httpEndpoint == '/'
289-
? endpoints.filter(e => e.route.some(x => x.name == '/') && (e.method == httpMethod || !e.method))[0]
289+
? endpoints.filter(e => e.route.some(x => x.name == '/') && (e.method == httpMethod || !e.method))
290+
.map(e => ({ route: e.route, winningRoute: e.route.filter(x => x.name == '/')[0], next: e.next, method: e.method }))[0]
290291
: (endpoints.map(e => ({ endpoint: e, route: e.route.map(r => matchRoute(httpEndpoint, r)).filter(r => r) }))
291292
.filter(e => e.route.length > 0 && (e.endpoint.method == httpMethod || !e.endpoint.method))
292293
.map(e => {

0 commit comments

Comments
 (0)