@@ -14,6 +14,11 @@ function forEach(arrayOfArrays) {
1414}
1515
1616const proxyIntegration = require ( '../lib/proxyIntegration' ) ;
17+ const expectedCorsHeaders = {
18+ "Access-Control-Allow-Origin" : "*" ,
19+ "Access-Control-Allow-Methods" : "'GET,POST,PUT,DELETE,HEAD'" ,
20+ "Access-Control-Allow-Headers" : "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
21+ } ;
1722
1823describe ( 'proxyIntegration.routeHandler.selection' , ( ) => {
1924 it ( 'should select longer match' , ( ) => {
@@ -106,9 +111,7 @@ describe('proxyIntegration.routeHandler.selection', () => {
106111 } , { httpMethod : 'OPTIONS' , path : '/' } ) . then ( result => {
107112 expect ( result ) . toEqual ( {
108113 statusCode : 200 ,
109- headers : {
110- "Access-Control-Allow-Origin" : "*"
111- } ,
114+ headers : expectedCorsHeaders ,
112115 body : ''
113116 } ) ;
114117 done ( ) ;
@@ -121,10 +124,7 @@ describe('proxyIntegration.routeHandler.selection', () => {
121124 } , { httpMethod : 'GET' , path : '/' } ) . then ( result => {
122125 expect ( result ) . toEqual ( {
123126 statusCode : 200 ,
124- headers : {
125- "Content-Type" : "application/json" ,
126- "Access-Control-Allow-Origin" : "*"
127- } ,
127+ headers : Object . assign ( { "Content-Type" : "application/json" } , expectedCorsHeaders ) ,
128128 body : '"/"'
129129 } ) ;
130130 done ( ) ;
@@ -307,7 +307,7 @@ describe('proxyIntegration.routeHandler', () => {
307307 expect ( result ) . toEqual ( {
308308 statusCode : 501 ,
309309 body : 'bla' ,
310- headers : { "Content-Type" : "application/json" , "Access-Control-Allow-Origin" : "*" }
310+ headers : Object . assign ( { "Content-Type" : "application/json" } , expectedCorsHeaders )
311311 } ) ;
312312 done ( ) ;
313313 } ) ;
0 commit comments