File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1- import type { MiddlewareObj } from '@middy/core'
1+ import type { MiddlewareObj , Request } from '@middy/core'
22import type {
33 APIGatewayProxyEventV2 ,
44 APIGatewayProxyStructuredResultV2 ,
55} from 'aws-lambda'
66
77export const addVersionHeader = (
88 version : string ,
9- ) : MiddlewareObj <
10- APIGatewayProxyEventV2 ,
11- APIGatewayProxyStructuredResultV2
12- > => ( {
13- after : async ( req ) => {
9+ ) : MiddlewareObj < APIGatewayProxyEventV2 , APIGatewayProxyStructuredResultV2 > => {
10+ const setVersionHeader = async ( req : Request ) => {
1411 if ( req . response === null ) return
1512 req . response = {
1613 ...req . response ,
@@ -19,5 +16,10 @@ export const addVersionHeader = (
1916 'x-backend-version' : version ,
2017 } ,
2118 }
22- } ,
23- } )
19+ }
20+
21+ return {
22+ after : setVersionHeader ,
23+ onError : setVersionHeader ,
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments