koa 2.8.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,4 +1,35 @@
1
1
 
2
+ 2.10.0 / 2019-10-12
3
+ ==================
4
+
5
+ **features**
6
+ * [[`d7f7f77`](http://github.com/koajs/koa/commit/d7f7f77689e2eaef050686be2bdf3e72881a79ac)] - feat: support sameSite=none cookies (bump cookies dependency) (#1390) (Filip Skokan <<panva.ip@gmail.com>>)
7
+
8
+ 2.9.0 / 2019-10-12
9
+ ==================
10
+
11
+ **features**
12
+ * [[`2d1c598`](http://github.com/koajs/koa/commit/2d1c5981869e0fe6f5bc71b5c5582accfd125cc6)] - feat: export HttpError from http-errors library (Micheal Hill <<micheal.hill@trunkplatform.com>>)
13
+
14
+ **others**
15
+ * [[`cf70dbc`](http://github.com/koajs/koa/commit/cf70dbc6d2ba62bf1eb12b563dd5ecd27af6e2be)] - Chore: Use https in readme (#1389) (谭九鼎 <<109224573@qq.com>>)
16
+
17
+ 2.8.2 / 2019-09-28
18
+ ==================
19
+
20
+ **fixes**
21
+ * [[`54e8fab`](http://github.com/koajs/koa/commit/54e8fab3e3d907bbb264caf3e28a24773d0d6fdb)] - fix: encode redirect url if not already encoded (#1384) (fengmk2 <<fengmk2@gmail.com>>)
22
+
23
+ **others**
24
+ * [[`817b498`](http://github.com/koajs/koa/commit/817b49830571b45a8aec6b1fc1525434f5798c58)] - test: fix body test (#1375) (Robert Nagy <<ronagy@icloud.com>>)
25
+ * [[`f75d445`](http://github.com/koajs/koa/commit/f75d4455359ecdf30eeb676e2c7f31d4cf7b42ed)] - test: fix end after end (#1374) (Robert Nagy <<ronagy@icloud.com>>)
26
+
27
+ 2.8.1 / 2019-08-19
28
+ ==================
29
+
30
+ **fixes**
31
+ * [[`287e589`](http://github.com/koajs/koa/commit/287e589ac773d3738b2aa7d40e0b6d43dde5261b)] - fix: make options more compatibility (dead-horse <<dead_horse@qq.com>>)
32
+
2
33
  2.8.0 / 2019-08-19
3
34
  ==================
4
35
 
package/Readme.md CHANGED
@@ -41,7 +41,7 @@ app.listen(3000);
41
41
 
42
42
  - [Kick-Off-Koa](https://github.com/koajs/kick-off-koa) - An intro to Koa via a set of self-guided workshops.
43
43
  - [Workshop](https://github.com/koajs/workshop) - A workshop to learn the basics of Koa, Express' spiritual successor.
44
- - [Introduction Screencast](http://knowthen.com/episode-3-koajs-quickstart-guide/) - An introduction to installing and getting started with Koa
44
+ - [Introduction Screencast](https://knowthen.com/episode-3-koajs-quickstart-guide/) - An introduction to installing and getting started with Koa
45
45
 
46
46
 
47
47
  ## Middleware
@@ -21,6 +21,7 @@ const http = require('http');
21
21
  const only = require('only');
22
22
  const convert = require('koa-convert');
23
23
  const deprecate = require('depd')('koa');
24
+ const { HttpError } = require('http-errors');
24
25
 
25
26
  /**
26
27
  * Expose `Application` class.
@@ -44,13 +45,14 @@ module.exports = class Application extends Emitter {
44
45
  *
45
46
  */
46
47
 
47
- constructor(options = {}) {
48
+ constructor(options) {
48
49
  super();
50
+ options = options || {};
49
51
  this.proxy = options.proxy || false;
50
- this.middleware = [];
51
52
  this.subdomainOffset = options.subdomainOffset || 2;
52
53
  this.env = options.env || process.env.NODE_ENV || 'development';
53
- this.keys = options.keys || undefined;
54
+ if (options.keys) this.keys = options.keys;
55
+ this.middleware = [];
54
56
  this.context = Object.create(context);
55
57
  this.request = Object.create(request);
56
58
  this.response = Object.create(response);
@@ -256,3 +258,9 @@ function respond(ctx) {
256
258
  }
257
259
  res.end(body);
258
260
  }
261
+
262
+ /**
263
+ * Make HttpError available to consumers of the library so that consumers don't
264
+ * have a direct dependency upon `http-errors`
265
+ */
266
+ module.exports.HttpError = HttpError;
package/lib/response.js CHANGED
@@ -19,6 +19,7 @@ const extname = require('path').extname;
19
19
  const vary = require('vary');
20
20
  const only = require('only');
21
21
  const util = require('util');
22
+ const encodeUrl = require('encodeurl');
22
23
 
23
24
  /**
24
25
  * Prototype.
@@ -260,7 +261,7 @@ module.exports = {
260
261
  redirect(url, alt) {
261
262
  // location
262
263
  if ('back' == url) url = this.ctx.get('Referrer') || alt || '/';
263
- this.set('Location', url);
264
+ this.set('Location', encodeUrl(url));
264
265
 
265
266
  // status
266
267
  if (!statuses.redirect[this.status]) this.status = 302;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koa",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "Koa web app framework",
5
5
  "main": "lib/application.js",
6
6
  "scripts": {
@@ -26,11 +26,12 @@
26
26
  "cache-content-type": "^1.0.0",
27
27
  "content-disposition": "~0.5.2",
28
28
  "content-type": "^1.0.4",
29
- "cookies": "~0.7.1",
29
+ "cookies": "~0.8.0",
30
30
  "debug": "~3.1.0",
31
31
  "delegates": "^1.0.0",
32
32
  "depd": "^1.1.2",
33
33
  "destroy": "^1.0.4",
34
+ "encodeurl": "^1.0.2",
34
35
  "error-inject": "^1.0.0",
35
36
  "escape-html": "^1.0.3",
36
37
  "fresh": "~0.5.2",