EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Ajax content type support
Yurii02e5dac3709a
diff --git a/client/src/ajax.ts b/client/src/ajax.tsindex 0d8f75408b..3907a68496 100644--- a/client/src/ajax.ts+++ b/client/src/ajax.ts@@ -118,12 +118,17 @@ const Ajax = {}xhr.open(method, urlObj);- xhr.setRequestHeader('Content-Type', contentType);- if (options.headers) {- for (const key in options.headers) {- xhr.setRequestHeader(key, options.headers[key]);- }+ const headers = options.headers ?? {}++ const hasContentType = Object.keys(headers).find(it => it.toLowerCase() === 'content-type');++ if (!hasContentType) {+ xhr.setRequestHeader('Content-Type', contentType);+ }++ for (const key in headers) {+ xhr.setRequestHeader(key, headers[key]);}if (beforeSend) {diff --git a/client/src/helpers/file-upload.js b/client/src/helpers/file-upload.jsindex e772418aed..02a546971d 100644--- a/client/src/helpers/file-upload.js+++ b/client/src/helpers/file-upload.js@@ -142,8 +142,8 @@ class FileUploadExport {Espo.Ajax.postRequest('Attachment/chunk/' + attachment.id, e.target.result, {headers: {- contentType: 'multipart/form-data',- }+ 'Content-Type': 'multipart/form-data',+ },}).then(() => {options.afterChunkUpload(end);