File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
infrastructure/terraform/components/api/resources
lambdas/api-handler/src/handlers Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 2828 "operationId" : " getStatusId" ,
2929 "responses" : {
3030 "200" : {
31- "description" : " Empty body "
31+ "description" : " OK "
3232 },
3333 "500" : {
3434 "description" : " Server error"
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ describe('API Lambda handler', () => {
1919
2020 expect ( result ) . toEqual ( {
2121 statusCode : 200 ,
22- body : '{}' ,
22+ body : JSON . stringify ( { code : 200 } , null , 2 )
2323 } ) ;
2424 } ) ;
2525
@@ -34,9 +34,10 @@ describe('API Lambda handler', () => {
3434 const getLetterDataHandler = createGetStatusHandler ( mockedDeps ) ;
3535 const result = await getLetterDataHandler ( event , mockDeep < Context > ( ) , jest . fn ( ) ) ;
3636
37- expect ( result ) . toEqual ( expect . objectContaining ( {
38- statusCode : 500
39- } ) ) ;
37+ expect ( result ) . toEqual ( {
38+ statusCode : 500 ,
39+ body : JSON . stringify ( { code : 500 } , null , 2 )
40+ } ) ;
4041 } ) ;
4142
4243
@@ -51,9 +52,10 @@ describe('API Lambda handler', () => {
5152 const getLetterDataHandler = createGetStatusHandler ( mockedDeps ) ;
5253 const result = await getLetterDataHandler ( event , mockDeep < Context > ( ) , jest . fn ( ) ) ;
5354
54- expect ( result ) . toEqual ( expect . objectContaining ( {
55- statusCode : 500
56- } ) ) ;
55+ expect ( result ) . toEqual ( {
56+ statusCode : 500 ,
57+ body : JSON . stringify ( { code : 500 } , null , 2 )
58+ } ) ;
5759 } ) ;
5860
5961
Original file line number Diff line number Diff line change @@ -17,10 +17,14 @@ export function createGetStatusHandler(deps: Deps): APIGatewayProxyHandler {
1717
1818 return {
1919 statusCode : 200 ,
20- body : '{}'
20+ body : JSON . stringify ( { code : 200 } , null , 2 )
2121 } ;
2222 } catch ( error ) {
23- return mapErrorToResponse ( error , undefined , deps . logger ) ;
23+ deps . logger . error ( { err : error } , 'Status endpoint error, services not available' ) ;
24+ return {
25+ statusCode : 500 ,
26+ body : JSON . stringify ( { code : 500 } , null , 2 )
27+ } ;
2428 }
2529 }
2630}
You can’t perform that action at this time.
0 commit comments