Commit 63ea32d
fix(express): make toFetchHandler always resolve to a Response (#9)
Since 0.2.3, toFetchHandler is built on connectToWeb, whose WebHandler can
resolve to undefined (the "no middleware handled the request" pass-through
signal). That undefined is not assignable to Server['fetch'], breaking the
documented `fetch: toFetchHandler(app)` pattern.
Wrap connectToWeb with a 404 fallback so toFetchHandler always resolves to a
Response, mirroring @universal-middleware's own nextOr404 convention for
terminal handlers, while keeping the cancel-event propagation that motivated
the move away from srvx's toFetchHandler.
Claude-Session: https://claude.ai/code/session_01GcNoNA6CzTQiSAS589U6Yu
Co-authored-by: Claude <noreply@anthropic.com>1 parent a8f42b7 commit 63ea32d
3 files changed
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
6 | 22 | | |
7 | 23 | | |
8 | 24 | | |
| |||
0 commit comments