We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e58540 commit f23e09cCopy full SHA for f23e09c
function/app.ts
@@ -137,15 +137,9 @@ export const lambdaHandler = async (event: LambdaFunctionURLEvent): Promise<Lamb
137
* @returns {boolean} - true if the headers have the correct content-type, false otherwise
138
*/
139
function hasValidContentType(headers: Record<string, string | undefined>): boolean {
140
- const contentType = ['content-type', 'Content-Type', 'CONTENT-TYPE'];
141
-
142
- for (const key of contentType) {
143
- if (headers[key] === ACCEPTABLE_CONTENT_TYPE) {
144
- return true;
145
- }
146
147
148
- return false;
+ return Object.entries(headers).some(
+ ([key, value]) => key.toLowerCase() === 'content-type' && value?.toLowerCase().startsWith(ACCEPTABLE_CONTENT_TYPE),
+ );
149
}
150
151
/**
0 commit comments