next function in single function case
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 176
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure, was such issue raised before or not, I tried search, but did not found.
Why `next` function is not provided if route have only 1 function?
https://github.com/lukeed/polka/blob/e7aa451fe311dae1915d043ee95a2dd1a75343ff/packages/polka/index.js#L92
Is not right code will be:
```js
if (len === i && num === 1) return fns[0](req, res, err => err && this.onError(err, req, res, next));
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at packages/polka/index.js around line 92 and inspect the single-function route dispatch path. Trace how the handler receives its arguments and how errors reach onError, then compare that behavior with routes containing multiple functions. Done means the single-function case consistently exposes the expected next callback without breaking error handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100