koa 3.0.0-alpha.5 → 3.0.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/lib/response.js +1 -15
- package/package.json +3 -5
package/lib/response.js
CHANGED
|
@@ -18,7 +18,6 @@ const isStream = require('./is-stream.js')
|
|
|
18
18
|
const only = require('./only.js')
|
|
19
19
|
const util = require('util')
|
|
20
20
|
const encodeUrl = require('encodeurl')
|
|
21
|
-
const deprecate = require('depd')('koa')
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Prototype.
|
|
@@ -273,29 +272,16 @@ module.exports = {
|
|
|
273
272
|
/**
|
|
274
273
|
* Perform a 302 redirect to `url`.
|
|
275
274
|
*
|
|
276
|
-
* The string "back" is special-cased
|
|
277
|
-
* to provide Referrer support, when Referrer
|
|
278
|
-
* is not present `alt` or "/" is used.
|
|
279
|
-
*
|
|
280
275
|
* Examples:
|
|
281
276
|
*
|
|
282
|
-
* this.redirect('back');
|
|
283
|
-
* this.redirect('back', '/index.html');
|
|
284
277
|
* this.redirect('/login');
|
|
285
278
|
* this.redirect('http://google.com');
|
|
286
279
|
*
|
|
287
280
|
* @param {String} url
|
|
288
|
-
* @param {String} [alt]
|
|
289
281
|
* @api public
|
|
290
282
|
*/
|
|
291
283
|
|
|
292
|
-
redirect (url
|
|
293
|
-
// location
|
|
294
|
-
if (url === 'back') {
|
|
295
|
-
deprecate('Special-cased string "back" through redirect will be removed in v3, ' +
|
|
296
|
-
'consider migrating usage to ctx.back() instead.')
|
|
297
|
-
url = this.ctx.get('Referrer') || alt || '/'
|
|
298
|
-
}
|
|
284
|
+
redirect (url) {
|
|
299
285
|
if (/^https?:\/\//i.test(url)) {
|
|
300
286
|
// formatting url again avoid security escapes
|
|
301
287
|
url = new URL(url).toString()
|
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koa",
|
|
3
|
-
"version": "3.0.0
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"tag": "experimental"
|
|
6
|
-
},
|
|
3
|
+
"version": "3.0.0",
|
|
7
4
|
"description": "Koa web app framework",
|
|
8
5
|
"main": "lib/application.js",
|
|
9
6
|
"exports": {
|
|
@@ -19,7 +16,7 @@
|
|
|
19
16
|
},
|
|
20
17
|
"scripts": {
|
|
21
18
|
"test": "node --test",
|
|
22
|
-
"test:coverage": "
|
|
19
|
+
"test:coverage": "c8 --reporter=lcov --reporter=text-summary node --test",
|
|
23
20
|
"lint": "standard",
|
|
24
21
|
"lint:pretty": "standard | snazzy",
|
|
25
22
|
"authors": "git log --format='%aN <%aE>' | sort -u > AUTHORS",
|
|
@@ -59,6 +56,7 @@
|
|
|
59
56
|
"vary": "^1.1.2"
|
|
60
57
|
},
|
|
61
58
|
"devDependencies": {
|
|
59
|
+
"c8": "^10.1.3",
|
|
62
60
|
"gen-esm-wrapper": "^1.0.6",
|
|
63
61
|
"snazzy": "^9.0.0",
|
|
64
62
|
"standard": "^17.1.0",
|