Browse Source

Default rest body type to json when there is an existing body

pull/4434/head
Rory Powell 5 years ago
parent
commit
4b2ce2a280
  1. 7
      packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte

7
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 DynamicVariableModal from "../../_components/DynamicVariableModal.svelte"
import Placeholder from "assets/bb-spaceship.svg" import Placeholder from "assets/bb-spaceship.svg"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import { RawRestBodyTypes } from "constants/backend"
let query, datasource let query, datasource
let breakQs = {}, let breakQs = {},
@ -253,7 +254,11 @@
} }
} }
if (query && !query.fields.bodyType) { 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) dynamicVariables = getDynamicVariables(datasource, query._id)
}) })

Loading…
Cancel
Save