feat(webhooks): handle form-data and text/plain reqs

This commit is contained in:
Ali BARIN
2022-12-25 16:28:58 +01:00
parent aca19f7f73
commit da9cb7d6eb
4 changed files with 251 additions and 20 deletions

View File

@@ -1,7 +1,18 @@
import { Router } from 'express';
import express, { Router } from 'express';
import multer from 'multer';
import { IRequest } from '@automatisch/types';
import webhookHandler from '../controllers/webhooks/handler';
const router = Router();
const upload = multer();
router.use(upload.none());
router.use(express.text({
verify(req, res, buf) {
(req as IRequest).rawBody = buf;
},
}));
router.get('/:flowId', webhookHandler);
router.put('/:flowId', webhookHandler);