whistle.script 1.2.8 → 1.2.9

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.
Files changed (2) hide show
  1. package/lib/util.js +4 -2
  2. package/package.json +1 -1
package/lib/util.js CHANGED
@@ -156,7 +156,7 @@ const request = (url, headers, data) => {
156
156
  clearTimeout(timer); // eslint-disable-line
157
157
  if (body) {
158
158
  try {
159
- resolve(JSON.parse(body.toString()) || '');
159
+ return resolve(JSON.parse(body.toString()) || '');
160
160
  } catch (e) {}
161
161
  }
162
162
  resolve('');
@@ -188,7 +188,9 @@ const hasPolicy = ({ headers, originalReq: { ruleValue } }, name) => {
188
188
  if (typeof policy === 'string') {
189
189
  return policy.toLowerCase().indexOf(name) !== -1;
190
190
  }
191
- return ruleValue === `policy=${name}`;
191
+ if (typeof ruleValue === 'string') {
192
+ return ruleValue.indexOf(`=${name}`) !== -1 || ruleValue.indexOf(`&${name}`) !== -1;
193
+ }
192
194
  };
193
195
 
194
196
  const isRemote = (req) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "whistle.script",
3
3
  "description": "The plugin for the extension script for whistle",
4
- "version": "1.2.8",
4
+ "version": "1.2.9",
5
5
  "author": "avenwu <avenwu@vip.qq.com>",
6
6
  "contributors": [],
7
7
  "license": "MIT",