From b1e6881fd241eec6016e9fa36a7c1b4881f41728 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Wed, 9 Apr 2025 17:47:33 -0300 Subject: [PATCH] fix: add conditional authorization header for dslf in curl commands (#7457) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ (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 --- src/frontend/src/modals/apiModal/utils/get-curl-code.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/modals/apiModal/utils/get-curl-code.tsx b/src/frontend/src/modals/apiModal/utils/get-curl-code.tsx index 27446cd5b..1de0c6c7c 100644 --- a/src/frontend/src/modals/apiModal/utils/get-curl-code.tsx +++ b/src/frontend/src/modals/apiModal/utils/get-curl-code.tsx @@ -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: '\\` : "" + -H 'Content-Type: application/json' \\${ + isAuth ? `\n -H 'x-api-key: ' \\` : "" + }${ + ENABLE_DATASTAX_LANGFLOW + ? `\n -H 'Authorization: Bearer ' \\` + : "" } -d '{"any": "data"}' `.trim();