diff --git a/src/core/api.js b/src/core/api.js index a366ad09..cf5b51a5 100644 --- a/src/core/api.js +++ b/src/core/api.js @@ -196,10 +196,10 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) { return res.sendStatus(404); } - streamInfo.headers = { - ...streamInfo.headers, - ...req.headers - }; + streamInfo.headers = new Map([ + streamInfo.headers || {}, + req.headers + ]); return stream(res, { type: 'internal', ...streamInfo }); }) diff --git a/src/modules/stream/manage.js b/src/modules/stream/manage.js index 06c73a6b..af041a67 100644 --- a/src/modules/stream/manage.js +++ b/src/modules/stream/manage.js @@ -87,10 +87,15 @@ export function createInternalStream(url, obj = {}) { setMaxListeners(Infinity, controller.signal); } + let headers; + if (obj.headers) { + headers = new Map(Object.entries(obj.headers)); + } + internalStreamCache[streamID] = { url, service: obj.service, - headers: obj.headers, + headers, controller, dispatcher };