Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 9ffeaa9

Browse files
soedirgoinian
authored andcommitted
fix: sanitize headers error
1 parent cfa0fda commit 9ffeaa9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ app.use(async (ctx: Context, next: () => Promise<unknown>) => {
105105
Status.MethodNotAllowed,
106106
`HTTP request method not supported (supported: ${supportedVerbs.join(' ')})`
107107
);
108-
};
108+
}
109109

110110

111111
if (request.method !== "OPTIONS" && VERIFY_JWT) {
@@ -121,8 +121,8 @@ app.use(async (ctx: Context, next: () => Promise<unknown>) => {
121121

122122
const sanitizedHeaders = sanitizeHeaders(resp.headers);
123123
if (request.method === "GET") {
124-
const contentTypeHeader = sanitizedHeaders.get('Content-Type') || sanitizeHeaders.get('content-type');
125-
if (contentTypeHeader.includes('text/html')) {
124+
const contentTypeHeader = sanitizedHeaders.get('Content-Type');
125+
if (contentTypeHeader?.includes('text/html')) {
126126
sanitizedHeaders.set('Content-Type', 'text/plain');
127127
}
128128
}

0 commit comments

Comments
 (0)