summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/headers.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/headers.js b/api/headers.js
new file mode 100644
index 00000000..9cbf6ac3
--- /dev/null
+++ b/api/headers.js
@@ -0,0 +1,13 @@
+// headers.js
+export default (req, res) => {
+ const headers = res.headers();
+ for (const key in headers) {
+ const value = headers[key];
+ if (typeof value === 'string') {
+ headers[key] = value.replace(/[^\x00-\x7F]/g, (char) => {
+ return `%${char.charCodeAt(0).toString(16).toUpperCase()}`;
+ });
+ }
+ }
+ return res;
+ }; \ No newline at end of file