Skip to content

Commit

Permalink
fix: webhook signature for storyblok
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorreem committed Jul 9, 2024
1 parent 52362ef commit d4ae868
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion src/webhooks/webhooks.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const generateMockHeaders = (body) => {

const createRequestObject = (body) => {
return {
rawBody: JSON.stringify(body),
rawBody: '' + body,
setEncoding: () => {},
encoding: 'utf8',
};
Expand Down
2 changes: 0 additions & 2 deletions src/webhooks/webhooks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit d4ae868

Please sign in to comment.