Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
internals.transmit = function (response) {
const request = response.request;
const length = internals.length(response);
// Pipes
const encoding = request._core.compression.encoding(response, length);
const ranger = encoding ? null : internals.range(response, length);
const compressor = internals.encoding(response, encoding);
// Connection: close
const isInjection = Shot.isInjection(request.raw.req);
if (!(isInjection || request._core.started) ||
request._isPayloadPending && !request.raw.req._readableState.ended) {
response._header('connection', 'close');
}
// Write headers
internals.writeHead(response);
// Injection
if (isInjection) {
request.raw.res[Config.symbol] = { request };
if (response.variety === 'plain') {