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:
parent
b2c74173b5
commit
b1e6881fd2
1 changed files with 7 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { ENABLE_DATASTAX_LANGFLOW } from "@/customization/feature-flags";
|
||||
import useFlowStore from "@/stores/flowStore";
|
||||
import { GetCodeType } from "@/types/tweaks";
|
||||
|
||||
|
|
@ -62,8 +63,12 @@ export function getCurlWebhookCode({
|
|||
|
||||
return `curl -X POST \\
|
||||
"${baseUrl}" \\
|
||||
-H 'Content-Type: application/json'\\${
|
||||
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : ""
|
||||
-H 'Content-Type: application/json' \\${
|
||||
isAuth ? `\n -H 'x-api-key: <your api key>' \\` : ""
|
||||
}${
|
||||
ENABLE_DATASTAX_LANGFLOW
|
||||
? `\n -H 'Authorization: Bearer <YOUR_APPLICATION_TOKEN>' \\`
|
||||
: ""
|
||||
}
|
||||
-d '{"any": "data"}'
|
||||
`.trim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue