Comparing version 1.0.0 to 1.1.0
@@ -18,2 +18,3 @@ 'use strict'; | ||
options = Object.assign({}, defaultOptions, options); | ||
if (!Array.isArray(options.callback)) options.callback = [ options.callback ]; | ||
@@ -60,3 +61,3 @@ const csrfEnable = this.plugins.security && this.plugins.security.enable // security enable | ||
// generate jsonp body | ||
const jsonpFunction = this.query[options.callback]; | ||
const jsonpFunction = getJsonpFunction(this.query, options.callback); | ||
if (jsonpFunction) { | ||
@@ -109,1 +110,7 @@ this.set('x-content-type-options', 'nosniff'); | ||
} | ||
function getJsonpFunction(query, callbacks) { | ||
for (const callback of callbacks) { | ||
if (query[callback]) return query[callback]; | ||
} | ||
} |
@@ -6,3 +6,3 @@ 'use strict'; | ||
* @member Config#jsonp | ||
* @property {String} callback - jsonp callback method key, default to `_callback` | ||
* @property {String} callback - jsonp callback method key, default to `['_callback', 'callback' ]` | ||
* @property {Number} limit - callback method name's max length, default to `50` | ||
@@ -14,5 +14,5 @@ * @property {Boolean} csrf - enable csrf check or not. default to false | ||
limit: 50, | ||
callback: '_callback', | ||
callback: [ '_callback', 'callback' ], | ||
csrf: false, | ||
whiteList: undefined, | ||
}; |
1.1.0 / 2017-06-01 | ||
================== | ||
* test: test on node 8 | ||
* feat: support _callback and callback | ||
1.0.0 / 2017-01-23 | ||
@@ -3,0 +9,0 @@ ================== |
{ | ||
"name": "egg-jsonp", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "jsonp support for egg", | ||
@@ -26,11 +26,11 @@ "eggPlugin": { | ||
"devDependencies": { | ||
"autod": "^2.7.1", | ||
"egg": "^0.8.0", | ||
"egg-bin": "^1.10.0", | ||
"egg-ci": "^1.1.0", | ||
"egg-mock": "^2.0.0", | ||
"eslint": "^3.13.1", | ||
"eslint-config-egg": "^3.2.0", | ||
"supertest": "^2.0.1", | ||
"webstorm-disable-index": "^1.1.2" | ||
"autod": "^2.8.0", | ||
"egg": "^1.4.0", | ||
"egg-bin": "^3.4.1", | ||
"egg-ci": "^1.6.0", | ||
"egg-mock": "^3.7.1", | ||
"eslint": "^3.19.0", | ||
"eslint-config-egg": "^4.2.0", | ||
"supertest": "^3.0.0", | ||
"webstorm-disable-index": "^1.2.0" | ||
}, | ||
@@ -57,3 +57,3 @@ "engines": { | ||
"ci": { | ||
"version": "6, 7" | ||
"version": "6, 7, 8" | ||
}, | ||
@@ -60,0 +60,0 @@ "repository": { |
@@ -43,3 +43,3 @@ # egg-jsonp | ||
* {String} callback - jsonp callback method key, default to `_callback` | ||
* {String|Array} callback - jsonp callback method key, default to `[ '_callback', 'callback' ]` | ||
* {Number} limit - callback method name's max length, default to `50` | ||
@@ -46,0 +46,0 @@ * {Boolean} csrf - enable csrf check or not. default to false |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
9828
111
1