summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/headers.js22
1 files changed, 0 insertions, 22 deletions
diff --git a/api/headers.js b/api/headers.js
deleted file mode 100644
index 73d00231..00000000
--- a/api/headers.js
+++ /dev/null
@@ -1,22 +0,0 @@
-export default (req, res) => {
- // 获取所有当前设置的响应头
- const headers = res.getHeaders();
-
- // 遍历响应头,修正非 ASCII 字符
- for (const key in headers) {
- const value = headers[key];
- if (typeof value === "string") {
- // 将非 ASCII 字符进行百分比编码
- const encodedValue = value.replace(/[^\x00-\x7F]/g, (char) =>
- `%${char.charCodeAt(0).toString(16).toUpperCase()}`
- );
-
- // 重置响应头
- res.setHeader(key, encodedValue);
- }
- }
-
- // 返回响应
- res.status(200).send("Headers processed successfully.");
- };
- \ No newline at end of file