diff --git a/src/webhooks/webhooks.controller.spec.ts b/src/webhooks/webhooks.controller.spec.ts index 0c88ee12..45d25d5f 100644 --- a/src/webhooks/webhooks.controller.spec.ts +++ b/src/webhooks/webhooks.controller.spec.ts @@ -27,7 +27,7 @@ const generateMockHeaders = (body) => { const createRequestObject = (body) => { return { - rawBody: JSON.stringify(body), + rawBody: '' + body, setEncoding: () => {}, encoding: 'utf8', }; diff --git a/src/webhooks/webhooks.controller.ts b/src/webhooks/webhooks.controller.ts index b6e33cf2..730010dd 100644 --- a/src/webhooks/webhooks.controller.ts +++ b/src/webhooks/webhooks.controller.ts @@ -54,8 +54,6 @@ export class WebhooksController { this.logger.error(error); throw new HttpException(error, HttpStatus.UNAUTHORIZED); } - - req.rawBody = '' + data; req.setEncoding('utf8'); const bodyHmac = createHmac('sha1', storyblokWebhookSecret).update(req.rawBody).digest('hex');