export const handler: APIGatewayProxyHandlerV2 = hackContentType( createOpenApiAwsLambdaHandler({ router: appRouter, createContext, }));
event.headers["content-type"]
createOpenApiAwsLambdaHandler
"application/json"
import { APIGatewayProxyHandlerV2 } from "aws-lambda";const charsetString = `; charset=utf-8`;/** a filthy hack to workaround requests from Zapier where header is * `Content-Type: application/json; charset=utf-8` */export const hackContentType = (fn: APIGatewayProxyHandlerV2): APIGatewayProxyHandlerV2 => (event, context, callback) => { const contentType = event.headers["content-type"]; if (contentType?.includes(charsetString)) { event.headers["content-type"] = contentType .replace(charsetString, "") .trim(); } return fn(event, context, callback); };
adapters/aws-lambda