mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
api: use Map for internal stream headers instead of plain object
This commit is contained in:
parent
315ddb17c1
commit
3096bc9df0
2 changed files with 10 additions and 5 deletions
|
@ -196,10 +196,10 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
streamInfo.headers = {
|
streamInfo.headers = new Map([
|
||||||
...streamInfo.headers,
|
streamInfo.headers || {},
|
||||||
...req.headers
|
req.headers
|
||||||
};
|
]);
|
||||||
|
|
||||||
return stream(res, { type: 'internal', ...streamInfo });
|
return stream(res, { type: 'internal', ...streamInfo });
|
||||||
})
|
})
|
||||||
|
|
|
@ -87,10 +87,15 @@ export function createInternalStream(url, obj = {}) {
|
||||||
setMaxListeners(Infinity, controller.signal);
|
setMaxListeners(Infinity, controller.signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let headers;
|
||||||
|
if (obj.headers) {
|
||||||
|
headers = new Map(Object.entries(obj.headers));
|
||||||
|
}
|
||||||
|
|
||||||
internalStreamCache[streamID] = {
|
internalStreamCache[streamID] = {
|
||||||
url,
|
url,
|
||||||
service: obj.service,
|
service: obj.service,
|
||||||
headers: obj.headers,
|
headers,
|
||||||
controller,
|
controller,
|
||||||
dispatcher
|
dispatcher
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue