Split out debug heading into 2 headers, one each for request/response

0 = no zlib compression
1 = use zlib compression
This commit is contained in:
Dev 2024-04-20 09:58:06 +01:00
parent df93245e9d
commit e2f3191212

View File

@ -64,10 +64,11 @@ export class AkiHttpListener implements IHttpListener
// determine if the payload is compressed. All PUT requests are, and POST requests without
// debug = 1 are as well. This should be fixed.
// let compressed = req.headers["content-encoding"] === "deflate";
const compressed = req.method === "PUT" || req.headers.debug !== "1";
const requestIsCompressed = req.headers.requestcompressed === "1";
const requestCompressed = req.method === "PUT" || requestIsCompressed;
const value = compressed ? zlib.inflateSync(buffer) : buffer;
if (req.headers.debug === "1")
const value = requestCompressed ? zlib.inflateSync(buffer) : buffer;
if (!requestIsCompressed)
{
this.logger.debug(value.toString(), true);
}
@ -107,7 +108,7 @@ export class AkiHttpListener implements IHttpListener
let handled = false;
// Check if this is a debug request, if so just send the raw response without transformation
if (req.headers.debug === "1")
if (req.headers.responsecompressed === "0")
{
this.sendJson(resp, output, sessionID);
}