Skip to content
Myr

fix(deno): fixed the bug calling `next()` multiple time in Serve Static (#594)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent f5fc910 · Browse files · 3 files+8 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−2 removed

  • tests:+6 added−0 removed
  • other:+2 added−2 removed

3 files+8 added−2 removed

modified:deno_dist/deno/serve-static.ts+1 added-1 removed
modified:deno_test/middleware.test.tsx+6 added
modified:src/deno/serve-static.ts+1 added-1 removed
13 unmodified lines
14 return async (c: Context, next: Next) => {15 // Do nothing if Response is already set16 if (c.finalized) {17 await next()18 return19 }2021 const url = new URL(c.req.url)22
10 unmodified lines
33 try {34 content = await Deno.readFile(path)35 } catch (e) {36 console.warn(`${e}`)36 await next()37 }3839 if (content) {40 const mimeType = getMimeType(path)
12 unmodified lines