ti2 1.0.52 → 1.0.53
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/index.js +3 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -177,7 +177,8 @@ module.exports = async ({
|
|
|
177
177
|
10,
|
|
178
178
|
);
|
|
179
179
|
ti2Events.emit('request.end', {
|
|
180
|
-
...
|
|
180
|
+
...body,
|
|
181
|
+
cacheKey: req.cacheKey,
|
|
181
182
|
responseTimeInMs,
|
|
182
183
|
responseStatusCode: res.statusCode,
|
|
183
184
|
});
|
|
@@ -195,14 +196,13 @@ module.exports = async ({
|
|
|
195
196
|
const body = req.customBody;
|
|
196
197
|
if (cachingOperations.indexOf(body.operationId) > -1) {
|
|
197
198
|
const cacheKey = hash(R.omit(['requestId', 'date'], body));
|
|
198
|
-
|
|
199
|
+
req.cacheKey = cacheKey;
|
|
199
200
|
const foundCache = await cache.get({
|
|
200
201
|
pluginName: body.params.appKey,
|
|
201
202
|
key: cacheKey,
|
|
202
203
|
});
|
|
203
204
|
if (foundCache) {
|
|
204
205
|
// console.log('foundCache', cacheKey);
|
|
205
|
-
req.customBody.usedCache = cacheKey;
|
|
206
206
|
res.json(foundCache);
|
|
207
207
|
}
|
|
208
208
|
const realSend = res.json;
|