diff --git a/resources/js/webtrees.js b/resources/js/webtrees.js index 3e68b335e9c..69ef203b4ba 100644 --- a/resources/js/webtrees.js +++ b/resources/js/webtrees.js @@ -62,7 +62,7 @@ * @param {string|FormData} body * @returns {Promise} */ - webtrees.httpPost= function (url, body = '') { + webtrees.httpPost = function (url, body = '') { const csrfToken = document.head.querySelector('meta[name=csrf]').getAttribute('content'); const options = { @@ -75,7 +75,9 @@ 'x-requested-with': 'XMLHttpRequest', }) }; - + if (! body) { + options.headers.append('Content-Type', 'application/x-www-form-urlencoded') + } return fetch(url, options, body); }