You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
401 B

'use strict';
const PassThrough = require('stream').PassThrough;
const mimicResponse = require('mimic-response');
const cloneResponse = response => {
if (!(response && response.pipe)) {
throw new TypeError('Parameter `response` must be a response stream.');
}
const clone = new PassThrough();
mimicResponse(response, clone);
return response.pipe(clone);
};
module.exports = cloneResponse;