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 d696f551c3
commit 4a04d1ccba
2 changed files with 16 additions and 15 deletions

View File

@ -132,13 +132,15 @@ export const executeWebhook =
resultValues,
groupId,
})
const { data: body, isJson } = bodyContent
? safeJsonParse(
parseVariables(variables, {
escapeForJson: !checkIfBodyIsAVariable(bodyContent),
})(bodyContent)
)
: { data: undefined, isJson: false }
const { data: body, isJson } =
bodyContent && webhook.method !== HttpMethod.GET
? safeJsonParse(
parseVariables(variables, {
escapeForJson: !checkIfBodyIsAVariable(bodyContent),
})(bodyContent)
)
: { data: undefined, isJson: false }
const request = {
url: parseVariables(variables)(
webhook.url + (queryParams !== '' ? `?${queryParams}` : '')
@ -151,8 +153,7 @@ export const executeWebhook =
? body
: undefined,
form: contentType === 'x-www-form-urlencoded' && body ? body : undefined,
body:
body && !isJson && webhook.method !== HttpMethod.GET ? body : undefined,
body: body && !isJson ? body : undefined,
}
try {
const response = await got(request.url, omit(request, 'url'))