fix: escape single quotes in the webhook curl example body (#12454)

This commit is contained in:
Raunak Burrows
2026-11-16 09:36:00 +01:00
committed by GitHub
parent 96c97b0cdb
commit b76af459bb
@@ -300,8 +300,10 @@ function waitForJobCompletion(UUID) {
const conversation = chat
? '# Any string names a conversation: reuse it for follow-ups, pick a new one to start over.\nCONVERSATION=$(uuidgen)\n'
: ''
// A `'` in an argument would end the single-quoted BODY, so close, escape and reopen it.
const body = JSON.stringify(cleanedRunnableArgs ?? {}).replaceAll("'", "'\\''")
return `${conversation}TOKEN='${token}'
${callMethod !== 'get' ? `BODY='${JSON.stringify(cleanedRunnableArgs ?? {})}'` : ''}
${callMethod !== 'get' ? `BODY='${body}'` : ''}
${chat ? `URL="${urlWith('$CONVERSATION')}"` : `URL='${url}'`}
${requestType === 'sync' ? 'RESULT=$(' : requestType === 'async' ? 'UUID=$(' : ''}curl -s ${
callMethod != 'get' ? "-H 'Content-Type: application/json'" : ''