Skip to content

Commit

Permalink
🐛 (webhook) Don't send body when GET method is used
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Sep 12, 2022
1 parent d696f55 commit 4a04d1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}` : '')
Expand All @@ -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'))
Expand Down
12 changes: 6 additions & 6 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
},
"devDependencies": {
"@rollup/plugin-commonjs": "22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "8.4.0",
"rollup": "2.78.1",
"@rollup/plugin-node-resolve": "^14.0.1",
"@rollup/plugin-typescript": "8.5.0",
"rollup": "2.79.0",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"tslib": "^2.4.0",
"typescript": "^4.8.2",
"aws-sdk": "2.1204.0",
"typescript": "^4.8.3",
"aws-sdk": "2.1213.0",
"models": "workspace:*",
"next": "12.2.5"
"next": "12.3.0"
},
"peerDependencies": {
"aws-sdk": "^2.1152.0",
Expand Down

0 comments on commit 4a04d1c

Please sign in to comment.