Comparing version 2.3.0 to 2.4.1
2.4.1 / 2017-11-06 | ||
================== | ||
* fix bad merge w/ 2.4.0 | ||
2.4.0 / 2017-11-06 | ||
================== | ||
UNPUBLISHED | ||
* update `package.engines.node` to be more strict | ||
* update `fresh@^0.5.2` | ||
* fix: `inspect()` no longer crashes `context` | ||
* fix: gated `res.statusMessage` for HTTP/2 | ||
* added: `app.handleRequest()` is exposed | ||
2.3.0 / 2017-06-20 | ||
================== | ||
* fix: use `Buffer.from()` | ||
* test on node 7 & 8 | ||
@@ -6,0 +24,0 @@ * add `package-lock.json` to `.gitignore` |
@@ -131,8 +131,4 @@ | ||
const handleRequest = (req, res) => { | ||
res.statusCode = 404; | ||
const ctx = this.createContext(req, res); | ||
const onerror = err => ctx.onerror(err); | ||
const handleResponse = () => respond(ctx); | ||
onFinished(res, onerror); | ||
return fn(ctx).then(handleResponse).catch(onerror); | ||
return this.handleRequest(ctx, fn); | ||
}; | ||
@@ -144,2 +140,17 @@ | ||
/** | ||
* Handle request in callback. | ||
* | ||
* @api private | ||
*/ | ||
handleRequest(ctx, fnMiddleware) { | ||
const res = ctx.res; | ||
res.statusCode = 404; | ||
const onerror = err => ctx.onerror(err); | ||
const handleResponse = () => respond(ctx); | ||
onFinished(res, onerror); | ||
return fnMiddleware(ctx).then(handleResponse).catch(onerror); | ||
} | ||
/** | ||
* Initialize a new context. | ||
@@ -146,0 +157,0 @@ * |
@@ -28,2 +28,3 @@ | ||
inspect() { | ||
if (this === proto) return this; | ||
return this.toJSON(); | ||
@@ -30,0 +31,0 @@ }, |
@@ -88,3 +88,3 @@ | ||
this.res.statusCode = code; | ||
this.res.statusMessage = statuses[code]; | ||
if (this.req.httpVersionMajor < 2) this.res.statusMessage = statuses[code]; | ||
if (this.body && statuses.empty[code]) this.body = null; | ||
@@ -91,0 +91,0 @@ }, |
{ | ||
"name": "koa", | ||
"version": "2.3.0", | ||
"version": "2.4.1", | ||
"description": "Koa web app framework", | ||
"main": "lib/application.js", | ||
"scripts": { | ||
"test": "jest --forceExit", | ||
"test": "jest", | ||
"test-cov": "npm run test -- --coverage", | ||
"lint": "eslint benchmarks lib test --fix", | ||
"bench": "make -C benchmarks" | ||
"lint": "eslint benchmarks lib test", | ||
"bench": "make -C benchmarks", | ||
"authors": "git log --format='%aN <%aE>' | sort -u > AUTHORS" | ||
}, | ||
@@ -34,3 +35,3 @@ "repository": "koajs/koa", | ||
"escape-html": "~1.0.1", | ||
"fresh": "^0.5.0", | ||
"fresh": "^0.5.2", | ||
"http-assert": "^1.1.0", | ||
@@ -61,3 +62,3 @@ "http-errors": "^1.2.8", | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
"node": "^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4" | ||
}, | ||
@@ -64,0 +65,0 @@ "files": [ |
@@ -1,2 +0,2 @@ | ||
<img src="https://dl.dropboxusercontent.com/u/6396913/koa/logo.png" alt="koa middleware framework for nodejs" width="255px" /> | ||
<img src="/docs/logo.png" alt="koa middleware framework for nodejs"/> | ||
@@ -198,3 +198,3 @@ [![gitter][gitter-image]][gitter-url] | ||
``` | ||
$ make test | ||
$ npm test | ||
``` | ||
@@ -215,3 +215,4 @@ | ||
- [Mailing list](https://groups.google.com/forum/#!forum/koajs) | ||
- [中文文档](https://github.com/guo-yu/koa-guide) | ||
- [中文文档 v1.x](https://github.com/guo-yu/koa-guide) | ||
- [中文文档 v2.x](https://github.com/demopark/koa-docs-Zh-CN) | ||
- __[#koajs]__ on freenode | ||
@@ -218,0 +219,0 @@ |
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
64820
1424
312
Updatedfresh@^0.5.2