From 4b2ce2a280f9969b640420ecb06e94a8ca4e59fc Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 20 Dec 2021 11:46:01 -0500 Subject: [PATCH] Default rest body type to json when there is an existing body --- .../[selectedDatasource]/rest/[query]/index.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 1d53b64c2d..15b2b574a6 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 @@ -36,6 +36,7 @@ import DynamicVariableModal from "../../_components/DynamicVariableModal.svelte" import Placeholder from "assets/bb-spaceship.svg" import { cloneDeep } from "lodash/fp" + import { RawRestBodyTypes } from "constants/backend" let query, datasource let breakQs = {}, @@ -253,7 +254,11 @@ } } if (query && !query.fields.bodyType) { - query.fields.bodyType = "none" + if (query.fields.requestBody) { + query.fields.bodyType = RawRestBodyTypes.JSON + } else { + query.fields.bodyType = RawRestBodyTypes.NONE + } } dynamicVariables = getDynamicVariables(datasource, query._id) })