1
0
Fork 0
mirror of synced 2024-10-04 12:03:31 +13:00

conditionally adds content-type json header if json is sent with request

This commit is contained in:
Keviin Åberg Kultalahti 2021-01-26 11:51:42 +01:00
parent 5d29d68897
commit b7006e097c

View file

@ -20,9 +20,10 @@ const makeApiCall = async ({ method, url, body, json = true }) => {
const requestBody = json ? JSON.stringify(body) : body
let headers = {
Accept: "application/json",
"Content-Type": "application/json",
...(json && { "Content-Type": "application/json" }),
"x-budibase-app-id": window["##BUDIBASE_APP_ID##"],
}
if (!window["##BUDIBASE_IN_BUILDER##"]) {
headers["x-budibase-type"] = "client"
}