From 8db63dda6054198775ed3b567dc3c1dbf73eb574 Mon Sep 17 00:00:00 2001 From: Shalvah Date: Fri, 3 Dec 2021 12:06:37 +0100 Subject: [PATCH] fix: Support `httpApi` payload override on function level (#1312) --- src/ServerlessOffline.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 5530c8d77..2e0d8c44b 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -369,10 +369,17 @@ export default class ServerlessOffline { } httpEvent.http.isHttpApi = true - httpEvent.http.payload = - service.provider.httpApi && service.provider.httpApi.payload - ? service.provider.httpApi.payload - : '2.0' + if ( + functionDefinition.httpApi && + functionDefinition.httpApi.payload + ) { + httpEvent.http.payload = functionDefinition.httpApi.payload + } else { + httpEvent.http.payload = + service.provider.httpApi && service.provider.httpApi.payload + ? service.provider.httpApi.payload + : '2.0' + } } if (http && http.private) {