diff --git a/lib/plugins-middleware.js b/lib/plugins-middleware.js index 8997412..422f079 100644 --- a/lib/plugins-middleware.js +++ b/lib/plugins-middleware.js @@ -235,7 +235,7 @@ function getTargetRequest(sourceRequest, sourceResponse, plugins, startTime, cor if (target_headers['content-length']) { delete target_headers['content-length']; - if(!target_headers['transfer-encoding'] && (sourceRequest.method==='DELETE' || sourceRequest.method==='GET')) { + if(!target_headers['transfer-encoding'] && (sourceRequest.method==='DELETE' || (sourceRequest.method==='GET' && config.edgemicro.enable_GET_req_body))) { target_headers['transfer-encoding'] = 'chunked'; } } @@ -468,6 +468,7 @@ function handleTargetResponse(targetRequest, targetResponse, options, cb) { */ function subscribeToSourceRequestEvents(plugins, sourceRequest, sourceResponse, targetRequest) { const logger = logging.getLogger(); + const config = configService.get(); // using apply on the array returned by getPluginHooksForEvent --> using a dummy object in place of this, which cannot be bound here. const onend_request_handlers = async.seq.apply({}, getPluginHooksForEvent('end', { @@ -501,7 +502,7 @@ function subscribeToSourceRequestEvents(plugins, sourceRequest, sourceResponse, }); }); - if (targetRequest.method === "HEAD") { + if ((targetRequest.method==='GET' && !config.edgemicro.enable_GET_req_body) || (targetRequest.method === "HEAD")) { targetRequest._hasBody = false; }