1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-25 04:02:48 +01:00

Fixed: Settings fields being altered during save

Closes #4309
This commit is contained in:
Mark McDowall 2021-02-06 19:28:33 -08:00
parent fc3bea370f
commit 42d9e37e7d

View File

@ -28,6 +28,15 @@ function addApiKey(ajaxOptions) {
ajaxOptions.headers['X-Api-Key'] = window.Sonarr.apiKey;
}
function addContentType(ajaxOptions) {
if (
!ajaxOptions.contentType &&
ajaxOptions.dataType === 'json' &&
(ajaxOptions.method === 'PUT' || ajaxOptions.method === 'POST')) {
ajaxOptions.contentType = 'application/json';
}
}
export default function createAjaxRequest(originalAjaxOptions) {
const requestXHR = new window.XMLHttpRequest();
let aborted = false;
@ -46,6 +55,7 @@ export default function createAjaxRequest(originalAjaxOptions) {
moveBodyToQuery(ajaxOptions);
addRootUrl(ajaxOptions);
addApiKey(ajaxOptions);
addContentType(ajaxOptions);
}
const request = $.ajax({