fix: add conditional authorization header for dslf in curl commands (#7457)

* ✨ (get-curl-code.tsx): add support for ENABLE_DATASTAX_LANGFLOW feature flag to include Authorization header in curl command if flag is enabled

* 🐛 (get-curl-code.tsx): fix conditional logic for adding x-api-key header in curl command to correctly handle authentication status

---------

Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
This commit is contained in:
Cristhian Zanforlin Lousa 2025-04-09 17:47:33 -03:00 • committed by GitHub
commit b1e6881fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
import { ENABLE_DATASTAX_LANGFLOW } from "@/customization/feature-flags";
import useFlowStore from "@/stores/flowStore"; import useFlowStore from "@/stores/flowStore";
import { GetCodeType } from "@/types/tweaks"; import { GetCodeType } from "@/types/tweaks";
@ -63,7 +64,11 @@ export function getCurlWebhookCode({
return `curl -X POST \\ return `curl -X POST \\
"${baseUrl}" \\ "${baseUrl}" \\
-H 'Content-Type: application/json' \\${ -H 'Content-Type: application/json' \\${
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : "" isAuth ? `\n -H 'x-api-key: <your api key>' \\` : ""
}${
ENABLE_DATASTAX_LANGFLOW
? `\n -H 'Authorization: Bearer <YOUR_APPLICATION_TOKEN>' \\`
: ""
} }
-d '{"any": "data"}' -d '{"any": "data"}'
`.trim(); `.trim();