koa-static
Advanced tools
Comparing version 4.0.0 to 4.0.1
4.0.1 / 2017-07-09 | ||
================== | ||
* Fix: throw error if error status not 404 | ||
* fix `index: false` bug if path is directory | ||
4.0.0 / 2017-07-03 | ||
@@ -3,0 +9,0 @@ ================== |
17
index.js
@@ -40,12 +40,17 @@ | ||
return async function serve (ctx, next) { | ||
let done = false | ||
if (ctx.method === 'HEAD' || ctx.method === 'GET') { | ||
try { | ||
await send(ctx, ctx.path, opts) | ||
done = await send(ctx, ctx.path, opts) | ||
} catch (err) { | ||
await next() | ||
if (err.status !== 404) { | ||
throw err | ||
} | ||
} | ||
return | ||
} | ||
await next() | ||
if (!done) { | ||
await next() | ||
} | ||
} | ||
@@ -64,5 +69,7 @@ } | ||
} catch (err) { | ||
ctx.status = err.status || 500 | ||
if (err.status !== 404) { | ||
throw err | ||
} | ||
} | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"repository": "koajs/static", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "koa", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7207
58