From 1670c31ba7cd365b122620b2cb0318191f175f20 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 13 Dec 2021 15:18:44 +0000 Subject: [PATCH] Fixing issue of disabled headers not being set for unmigrated queries. --- .../src/components/integration/KeyValueBuilder.svelte | 4 +--- .../[selectedDatasource]/rest/[query]/index.svelte | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 9c438f107d..19da99fdc6 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -41,9 +41,7 @@ for (let [key, value] of Object.entries(obj)) { const field = fields.find(el => el.name === key) const idx = fields.indexOf(field) - if (idx !== -1) { - array[idx] = value - } + array[idx] = idx !== -1 ? value : true } return array } diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte index f1c56bbd29..838646d806 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte @@ -145,6 +145,15 @@ url = buildUrl(query.fields.path, breakQs) schema = schemaToFields(query.schema) bindings = queryParametersToKeyValue(query.parameters) + if (!query.fields.disabledHeaders) { + query.fields.disabledHeaders = {} + } + // make sure the disabled headers are set (migration) + for (let header of Object.keys(query.fields.headers)) { + if (!query.fields.disabledHeaders[header]) { + query.fields.disabledHeaders[header] = false + } + } enabledHeaders = flipHeaderState(query.fields.disabledHeaders) if (query && !query.transformer) { query.transformer = "return data"