WebSocketMockIntegrationProps Struct
Props for Mock type integration for a WebSocket Api.
Example
ts
import { WebSocketMockIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi');
new apigwv2.WebSocketStage(this, 'mystage', {
webSocketApi,
stageName: 'dev',
autoDeploy: true,
});
webSocketApi.addRoute('sendMessage', {
integration: new WebSocketMockIntegration('DefaultIntegration', {
requestTemplates: { 'application/json': JSON.stringify({ statusCode: 200 }) },
templateSelectionExpression: '\\$default',
}),
returnResponse: true,
});
Properties
requestTemplatesoptional{ [key: string]: string }request_templatesoptionaltyping.Mapping[str, str]requestTemplatesoptionalMap<String, String>RequestTemplatesoptionalIDictionary<string, string>RequestTemplatesoptional*map[string]*string#A map of Apache Velocity templates that are applied on the request payload.
Default: No request template provided to the integration.
{ "application/json": "{ \"statusCode\": 200 }" }
templateSelectionExpressionoptionalstringtemplate_selection_expressionoptionalstrtemplateSelectionExpressionoptionalStringTemplateSelectionExpressionoptionalstringTemplateSelectionExpressionoptional*string#The template selection expression for the integration.
Default: No template selection expression provided.