Skip to content

Instantly share code, notes, and snippets.

View leonelgalan's full-sized avatar

Leonel Galán leonelgalan

View GitHub Profile
@leonelgalan
leonelgalan / stacks.ts
Created January 21, 2022 19:01
AWS API Gateway Mock Integration that responds with the JSON: `{"message": "Hello world!"}` to all requests for JSON or missing the Content-Type header.
import { Stack, StackProps } from 'aws-cdk-lib';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
import { Construct } from 'constructs';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const mockIntegration = new apigateway.MockIntegration({
passthroughBehavior: apigateway.PassthroughBehavior.WHEN_NO_TEMPLATES,