(method, pathname)
| 332 | } |
| 333 | |
| 334 | _matchRoute(method, pathname) { |
| 335 | for (const [pattern, handler] of Object.entries(this.routes)) { |
| 336 | const [routeMethod, routePath] = pattern.split(' '); |
| 337 | if (routeMethod !== method) continue; |
| 338 | |
| 339 | const params = matchPath(routePath, pathname); |
| 340 | if (params !== null) return { handler, params }; |
| 341 | } |
| 342 | return null; |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | function matchPath(pattern, pathname) { |
no test coverage detected