2
0

🐛 (webhook) Don't send body when GET method is used

This commit is contained in:
Baptiste Arnaud
2022-09-11 11:42:25 +02:00
parent 1a7c25ef0b
commit d696f551c3

View File

@ -10,6 +10,7 @@ import {
WebhookOptions, WebhookOptions,
WebhookResponse, WebhookResponse,
WebhookBlock, WebhookBlock,
HttpMethod,
} from 'models' } from 'models'
import { parseVariables } from 'bot-engine' import { parseVariables } from 'bot-engine'
import { NextApiRequest, NextApiResponse } from 'next' import { NextApiRequest, NextApiResponse } from 'next'
@ -150,7 +151,8 @@ export const executeWebhook =
? body ? body
: undefined, : undefined,
form: contentType === 'x-www-form-urlencoded' && body ? body : undefined, form: contentType === 'x-www-form-urlencoded' && body ? body : undefined,
body: body && !isJson ? body : undefined, body:
body && !isJson && webhook.method !== HttpMethod.GET ? body : undefined,
} }
try { try {
const response = await got(request.url, omit(request, 'url')) const response = await got(request.url, omit(request, 'url'))