mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +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);
|
||||
}
|
||||
|
||||
streamInfo.headers = {
|
||||
...streamInfo.headers,
|
||||
...req.headers
|
||||
};
|
||||
streamInfo.headers = new Map([
|
||||
streamInfo.headers || {},
|
||||
req.headers
|
||||
]);
|
||||
|
||||
return stream(res, { type: 'internal', ...streamInfo });
|
||||
})
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue