Procházet zdrojové kódy

fix: headers not working in http request block

Ahmad Kholid před 2 roky
rodič
revize
cfed0d1307

+ 2 - 1
src/components/newtab/workflow/edit/EditWebhook.vue

@@ -172,10 +172,11 @@ const { t } = useI18n();
 
 const methods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
 const notHaveBody = ['GET', 'DELETE'];
+const copyHeaders = JSON.parse(JSON.stringify(props.data.headers));
 
 const activeTab = ref('headers');
 const showBodyModal = ref(false);
-const headers = ref(JSON.parse(JSON.stringify(props.data.headers)));
+const headers = ref(Array.isArray(copyHeaders) ? copyHeaders : []);
 
 function updateData(value) {
   emit('update:data', { ...props.data, ...value });

+ 1 - 1
src/utils/webhookUtil.js

@@ -29,7 +29,7 @@ const renderContent = (content, contentType) => {
 const filterHeaders = (headers) => {
   const filteredHeaders = {};
 
-  if (!headers) return filteredHeaders;
+  if (!headers || !Array.isArray(headers)) return filteredHeaders;
 
   headers.forEach((item) => {
     if (item.name && item.value) {