♻️ (builder) Change to features-centric folder structure
This commit is contained in:
committed by
Baptiste Arnaud
parent
3686465a85
commit
643571fe7d
12
apps/builder/src/pages/api/mock/webhook-easy-config.ts
Normal file
12
apps/builder/src/pages/api/mock/webhook-easy-config.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
return res.status(200).send(req.body)
|
||||
}
|
||||
return methodNotAllowed(res)
|
||||
}
|
||||
|
||||
export default withSentry(handler)
|
27
apps/builder/src/pages/api/mock/webhook.ts
Normal file
27
apps/builder/src/pages/api/mock/webhook.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
const firstParam = req.query.firstParam?.toString()
|
||||
const secondParam = req.query.secondParam?.toString()
|
||||
const customHeader = req.headers['custom-typebot']
|
||||
const { body } = req
|
||||
if (
|
||||
body.customField === 'secret4' &&
|
||||
customHeader === 'secret3' &&
|
||||
secondParam === 'secret2' &&
|
||||
firstParam === 'secret1'
|
||||
) {
|
||||
return res.status(200).send([
|
||||
{ name: 'John', age: 21 },
|
||||
{ name: 'Tim', age: 52 },
|
||||
])
|
||||
}
|
||||
return res.status(400).send({ message: 'Bad request' })
|
||||
}
|
||||
return methodNotAllowed(res)
|
||||
}
|
||||
|
||||
export default withSentry(handler)
|
Reference in New Issue
Block a user