@@ -193,6 +193,12 @@ export const lambdaRouteProxyEntryHandler =
193193 ...retVal ,
194194 isBase64Encoded : false ,
195195 headers : {
196+ "Access-Control-Allow-Origin" : "*" ,
197+ "Access-Control-Allow-Methods" :
198+ "GET, POST, PUT, DELETE, PATCH, OPTIONS" ,
199+ "Access-Control-Allow-Headers" :
200+ "Content-Type, Authorization, X-Amz-Date, X-Api-Key, X-Amz-Security-Token" ,
201+ "Access-Control-Allow-Credentials" : "true" ,
196202 "Content-Type" : "application/json" ,
197203 ...( retVal . headers ?? { } ) ,
198204 } ,
@@ -201,13 +207,13 @@ export const lambdaRouteProxyEntryHandler =
201207 ? JSON . stringify ( retVal . body )
202208 : retVal . body ,
203209 } ;
204- } else {
205- retVal = {
206- statusCode : 200 ,
207- body : JSON . stringify ( retVal ) ,
208- "Content-Type" : "application/json" ,
209- } ;
210210 }
211+ } else {
212+ retVal = {
213+ statusCode : 200 ,
214+ body : JSON . stringify ( retVal ) ,
215+ "Content-Type" : "application/json" ,
216+ } ;
211217 }
212218 } catch ( error : any ) {
213219 console . error ( JSON . stringify ( { error, stack : error . stack } ) ) ;
@@ -218,7 +224,8 @@ export const lambdaRouteProxyEntryHandler =
218224 let statusCode = 500 ;
219225
220226 if ( isProxied ) {
221- const isOptions = ( event . requestContext as any ) . httpMethod === "OPTIONS" ;
227+ const isOptions =
228+ ( event . requestContext as any ) . httpMethod === "OPTIONS" ;
222229 if ( isOptions ) {
223230 statusCode = 200 ;
224231 } else {
0 commit comments