@less-is-more/less-js 1.4.33-1 → 1.4.33-3
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/package.json +1 -1
- package/src/cache.js +1 -1
- package/src/router.js +5 -1
package/package.json
CHANGED
package/src/cache.js
CHANGED
|
@@ -91,7 +91,7 @@ module.exports = class Cache {
|
|
|
91
91
|
let text = "";
|
|
92
92
|
const buffer = Buffer.from(content, "base64");
|
|
93
93
|
// 判断是否gzip
|
|
94
|
-
if (buffer[0] === 0x1f && buffer[1] === 0x8b) {
|
|
94
|
+
if (buffer.length > 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) {
|
|
95
95
|
console.log("unzip");
|
|
96
96
|
text = zlib.gunzipSync(buffer).toString();
|
|
97
97
|
} else {
|
package/src/router.js
CHANGED
|
@@ -161,7 +161,11 @@ module.exports = class Router {
|
|
|
161
161
|
}
|
|
162
162
|
} else {
|
|
163
163
|
const data = req.body || (await promisify(content)(req));
|
|
164
|
-
|
|
164
|
+
try {
|
|
165
|
+
req.sourceBody = decodeURIComponent(data.toString());
|
|
166
|
+
} catch (e) {
|
|
167
|
+
req.sourceBody = data.toString();
|
|
168
|
+
}
|
|
165
169
|
req.body = qs.parse(data.toString());
|
|
166
170
|
}
|
|
167
171
|
}
|