@@ -43,7 +43,6 @@ module.exports = {
4343 } ,
4444
4545 getMethodIntegration ( stateMachineName , customName , http ) {
46- const stateMachineLogicalId = this . getStateMachineLogicalId ( stateMachineName , customName ) ;
4746 const apiToStepFunctionsIamRoleLogicalId = this . getApiToStepFunctionsIamRoleLogicalId ( ) ;
4847 const integration = {
4948 IntegrationHttpMethod : 'POST' ,
@@ -67,32 +66,7 @@ module.exports = {
6766 ] ,
6867 } ,
6968 PassthroughBehavior : 'NEVER' ,
70- RequestTemplates : {
71- 'application/json' : {
72- 'Fn::Join' : [
73- '' , [
74- "#set( $body = $util.escapeJavaScript($input.json('$')) ) \n\n" ,
75- '{"input": "$body","name": "$context.requestId","stateMachineArn":"' ,
76- {
77- Ref : `${ stateMachineLogicalId } ` ,
78- } ,
79- '"}' ,
80- ] ,
81- ] ,
82- } ,
83- 'application/x-www-form-urlencoded' : {
84- 'Fn::Join' : [
85- '' , [
86- "#set( $body = $util.escapeJavaScript($input.json('$')) ) \n\n" ,
87- '{"input": "$body","name": "$context.requestId","stateMachineArn":"' ,
88- {
89- Ref : `${ stateMachineLogicalId } ` ,
90- } ,
91- '"}' ,
92- ] ,
93- ] ,
94- } ,
95- } ,
69+ RequestTemplates : this . getIntegrationRequestTemplates ( stateMachineName , customName , http )
9670 } ;
9771
9872 const integrationResponse = {
@@ -134,6 +108,36 @@ module.exports = {
134108 } ;
135109 } ,
136110
111+ getIntegrationRequestTemplates ( stateMachineName , customName , http ) {
112+ const stateMachineLogicalId = this . getStateMachineLogicalId ( stateMachineName , customName ) ;
113+ return {
114+ 'application/json' : {
115+ 'Fn::Join' : [
116+ '' , [
117+ "#set( $body = $util.escapeJavaScript($input.json('$')) ) \n\n" ,
118+ '{"input": "$body","name": "$context.requestId","stateMachineArn":"' ,
119+ {
120+ Ref : `${ stateMachineLogicalId } ` ,
121+ } ,
122+ '"}' ,
123+ ] ,
124+ ] ,
125+ } ,
126+ 'application/x-www-form-urlencoded' : {
127+ 'Fn::Join' : [
128+ '' , [
129+ "#set( $body = $util.escapeJavaScript($input.json('$')) ) \n\n" ,
130+ '{"input": "$body","name": "$context.requestId","stateMachineArn":"' ,
131+ {
132+ Ref : `${ stateMachineLogicalId } ` ,
133+ } ,
134+ '"}' ,
135+ ] ,
136+ ] ,
137+ } ,
138+ }
139+ } ,
140+
137141 getMethodResponses ( http ) {
138142 const methodResponse = {
139143 Properties : {
0 commit comments