From 1568db33bcce4a9c700e85d9708d71dfb1727355 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Mon, 4 Dec 2023 08:16:39 -0800 Subject: [PATCH] fix(send): apply custom headers for piped stream - see (#198) 1cf649c5d6e3924a41a42097156145b0daafc957 --- packages/send/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/send/index.js b/packages/send/index.js index a2ae100..51e51ea 100644 --- a/packages/send/index.js +++ b/packages/send/index.js @@ -14,7 +14,10 @@ export default function (res, code=200, data='', headers={}) { let type = obj[TYPE.toLowerCase()] || res.getHeader(TYPE); if (!!data && typeof data.pipe === 'function') { - res.setHeader(TYPE, type || OSTREAM); + obj[TYPE] = type || OSTREAM; + for (k in obj) { + res.setHeader(k, obj[k]); + } return data.pipe(res); }