mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-29 07:50:33 +00:00
feat: 支持使用脚本删除响应头字段
This commit is contained in:
4 files changed
+21
-4
No files matched your search
@@ -364,7 +364,11 @@ async function downloadSubscription(req, res) {
|
||||
if ($options?._res?.headers) {
|
||||
Object.entries($options._res.headers).forEach(
|
||||
([key, value]) => {
|
||||
res.set(key, value);
|
||||
if (value == null) {
|
||||
res.removeHeader(key);
|
||||
} else {
|
||||
res.set(key, value);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -650,7 +654,11 @@ async function downloadCollection(req, res) {
|
||||
if ($options?._res?.headers) {
|
||||
Object.entries($options._res.headers).forEach(
|
||||
([key, value]) => {
|
||||
res.set(key, value);
|
||||
if (value == null) {
|
||||
res.removeHeader(key);
|
||||
} else {
|
||||
res.set(key, value);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,11 @@ async function getFile(req, res, next) {
|
||||
if (output?.$options?._res?.headers) {
|
||||
Object.entries(output.$options._res.headers).forEach(
|
||||
([key, value]) => {
|
||||
res.set(key, value);
|
||||
if (value == null) {
|
||||
res.removeHeader(key);
|
||||
} else {
|
||||
res.set(key, value);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+5
@@ -224,6 +224,11 @@ export default function express({ substore: $, port, host }) {
|
||||
headers[key] = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
removeHeader(key) {
|
||||
delete headers[key];
|
||||
return this;
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user