diff --git a/packages/core/src/app-middlewares/after/large-response-cacher.js b/packages/core/src/app-middlewares/after/large-response-cacher.js index d7a97b8aa..db0068378 100644 --- a/packages/core/src/app-middlewares/after/large-response-cacher.js +++ b/packages/core/src/app-middlewares/after/large-response-cacher.js @@ -28,6 +28,13 @@ const largeResponseCachePointer = async (output) => { output.resultsUrl = url; output.results = Array.isArray(output.results) ? [] : {}; } + + if (size > autostashLimit) { + console.log( + `Oh no! Payload is ${size}, which is larger than ${autostashLimit}.` + ); + } + return output; }; diff --git a/packages/core/src/http-middlewares/after/log-response.js b/packages/core/src/http-middlewares/after/log-response.js index a396ba462..e6fd20e54 100644 --- a/packages/core/src/http-middlewares/after/log-response.js +++ b/packages/core/src/http-middlewares/after/log-response.js @@ -8,6 +8,7 @@ const prepareRequestLog = (req, resp) => { req = req || {}; resp = resp || {}; + let responseSize = 0; let responseBody; if (!req.raw) { if (typeof resp.content !== 'string') { @@ -15,6 +16,7 @@ const prepareRequestLog = (req, resp) => { } else { responseBody = resp.content; } + responseSize = Buffer.byteLength(responseBody, 'utf8'); // Get size in bytes } else { responseBody = ''; } @@ -36,6 +38,7 @@ const prepareRequestLog = (req, resp) => { response_status_code: resp.status, response_headers: resp.headers, response_content: responseBody, + response_size: responseSize, }; if (req._requestStart) {