From a74f756455c735a3ed4285e6d7befed0fa8e0988 Mon Sep 17 00:00:00 2001 From: Niklaus Schiess Date: Wed, 31 Jul 2024 09:39:20 +0200 Subject: [PATCH] Update resource.ts Set `passthroughBehavior` behavior to `NEVER` to prevent errors for CORS preflight requests with content-types other than `application/json`. --- packages/aws-cdk-lib/aws-apigateway/lib/resource.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts b/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts index 16f6af41840ba..24104dbbc6c38 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts @@ -1,7 +1,7 @@ import { Construct } from 'constructs'; import { CfnResource, CfnResourceProps } from './apigateway.generated'; import { Cors, CorsOptions } from './cors'; -import { Integration } from './integration'; +import { Integration, PassthroughBehavior } from './integration'; import { MockIntegration } from './integrations'; import { Method, MethodOptions, AuthorizationType } from './method'; import { IRestApi, RestApi } from './restapi'; @@ -295,6 +295,7 @@ export abstract class ResourceBase extends ResourceConstruct implements IResourc integrationResponses: [ { statusCode: `${statusCode}`, responseParameters: integrationResponseParams, responseTemplates: renderResponseTemplate() }, ], + passthroughBehavior: PassthroughBehavior.NEVER, }), { authorizer: { authorizerId: '',