From c552ab761f803f246f1aa512575f608530b5e1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Tue, 26 Jan 2021 11:51:42 +0100 Subject: [PATCH] conditionally adds content-type json header if json is sent with request --- packages/client/src/api/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index a88398ed3a..aea4944aae 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -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" }