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.
- package/lib/util.js +4 -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
|
-
|
|
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) => {
|