Comparing version 2.0.0-alpha.7 to 2.0.0-alpha.8
@@ -5,2 +5,3 @@ | ||
* Fix malformed content-type header causing exception on charset get (#898) | ||
* fix: subdomains should be [] if the host is an ip (#808) | ||
@@ -16,2 +17,7 @@ * don't pre-bound onerror [breaking change] (#800) | ||
2.0.0-alpha.8 / 2017-02-13 | ||
================== | ||
* Fix malformed content-type header causing exception on charset get (#898) | ||
2.0.0-alpha.7 / 2016-09-07 | ||
@@ -18,0 +24,0 @@ ================== |
@@ -108,3 +108,3 @@ | ||
if (isGeneratorFunction(fn)) { | ||
deprecate('Support for generators will been removed in v3. ' + | ||
deprecate('Support for generators will be removed in v3. ' + | ||
'See the documentation for examples of how to convert old middleware ' + | ||
@@ -111,0 +111,0 @@ 'https://github.com/koajs/koa/tree/v2.x#old-signature-middleware-v1x---deprecated'); |
@@ -318,6 +318,12 @@ | ||
get charset() { | ||
const type = this.get('Content-Type'); | ||
let type = this.get('Content-Type'); | ||
if (!type) return ''; | ||
return contentType.parse(type).parameters.charset || ''; | ||
try { | ||
type = contentType.parse(type); | ||
} catch (e) { | ||
return ''; | ||
} | ||
return type.parameters.charset || ''; | ||
}, | ||
@@ -419,3 +425,3 @@ | ||
* Check if the given `type(s)` is acceptable, returning | ||
* the best match when true, otherwise `undefined`, in which | ||
* the best match when true, otherwise `false`, in which | ||
* case you should respond with 406 "Not Acceptable". | ||
@@ -447,3 +453,3 @@ * | ||
* this.accepts('png'); | ||
* // => undefined | ||
* // => false | ||
* | ||
@@ -456,3 +462,3 @@ * // Accept: text/*;q=.5, application/json | ||
* @param {String|Array} type(s)... | ||
* @return {String|Array|Boolean} | ||
* @return {String|Array|false} | ||
* @api public | ||
@@ -459,0 +465,0 @@ */ |
{ | ||
"name": "koa", | ||
"version": "2.0.0-alpha.7", | ||
"version": "2.0.0-alpha.8", | ||
"description": "Koa web app framework", | ||
@@ -5,0 +5,0 @@ "main": "lib/application.js", |
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
49859
1361