Skip to content

Commit

Permalink
fix(send): apply custom headers for piped stream
Browse files Browse the repository at this point in the history
- see (#198) 1cf649c
  • Loading branch information
lukeed committed Dec 4, 2023
1 parent a42c247 commit 1568db3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 1568db3

Please sign in to comment.