@@ -141,6 +141,52 @@ describe('#methods()', () => {
141141 } ) . Properties . Integration . Uri [ 'Fn::Join' ] [ 1 ] [ 2 ] )
142142 . to . equal ( ':states:action/DescribeExecution' ) ;
143143 } ) ;
144+
145+ it ( 'should return a custom template for application/json when one is given' ,
146+ ( ) => {
147+ const httpWithResponseTemplate = {
148+ path : 'foo/bar1' ,
149+ method : 'post' ,
150+ response : {
151+ template : {
152+ 'application/json' : 'custom template' ,
153+ } ,
154+ } ,
155+ } ;
156+ const resource = serverlessStepFunctions
157+ . getMethodIntegration ( 'stateMachine' , undefined , httpWithResponseTemplate ) ;
158+ const responseTemplates = resource
159+ . Properties . Integration . IntegrationResponses
160+ . find ( x => x . StatusCode === 200 )
161+ . ResponseTemplates ;
162+ expect ( responseTemplates [ 'application/json' ] )
163+ . to . be . equal ( 'custom template' ) ;
164+ } ) ;
165+
166+ it ( 'should return custom headers when one is given' ,
167+ ( ) => {
168+ const httpWithResponseHeaders = {
169+ path : 'foo/bar1' ,
170+ method : 'post' ,
171+ response : {
172+ headers : {
173+ 'Content-Type' : 'text' ,
174+ 'X-Application-Id' : 'id' ,
175+ } ,
176+ } ,
177+ } ;
178+ const resource = serverlessStepFunctions
179+ . getMethodIntegration ( 'stateMachine' , undefined , httpWithResponseHeaders ) ;
180+
181+ const intResponseParams = resource
182+ . Properties . Integration . IntegrationResponses
183+ . find ( x => x . StatusCode === 200 )
184+ . ResponseParameters ;
185+ expect ( intResponseParams [ 'method.response.header.Content-Type' ] )
186+ . to . be . equal ( 'text' ) ;
187+ expect ( intResponseParams [ 'method.response.header.X-Application-Id' ] )
188+ . to . be . equal ( 'id' ) ;
189+ } ) ;
144190 } ) ;
145191
146192 describe ( '#getIntegrationRequestTemplates()' , ( ) => {
@@ -322,6 +368,19 @@ describe('#methods()', () => {
322368 . ResponseParameters [ 'method.response.header.Access-Control-Allow-Origin' ] )
323369 . to . equal ( '\'*\'' ) ;
324370 } ) ;
371+
372+ it ( 'should set custom custom headers when one is given' ,
373+ ( ) => {
374+ expect ( serverlessStepFunctions . getMethodResponses ( {
375+ response : {
376+ headers : {
377+ 'X-Application-Id' : 'id' ,
378+ } ,
379+ } ,
380+ } ) . Properties . MethodResponses [ 0 ]
381+ . ResponseParameters [ 'method.response.header.X-Application-Id' ] )
382+ . to . equal ( 'id' ) ;
383+ } ) ;
325384 } ) ;
326385
327386 describe ( '#getMethodAuthorization()' , ( ) => {
0 commit comments