From 8dcbacb196e363b1e184f21a1d7c19ca709bdaca Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 31 Aug 2020 15:48:24 +0200 Subject: [PATCH 1/2] Add application/json as content type for JSON requests --- src/components/channelMapper/channelMapper.js | 1 + src/components/directorybrowser/directorybrowser.js | 3 ++- src/controllers/dashboard/encodingsettings.js | 3 ++- src/controllers/session/resetPassword/index.js | 3 ++- src/controllers/wizard/remote/index.js | 3 ++- src/controllers/wizard/settings/index.js | 3 ++- src/controllers/wizard/start/index.js | 3 ++- src/controllers/wizard/user/index.js | 3 ++- 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/channelMapper/channelMapper.js b/src/components/channelMapper/channelMapper.js index e74727969..2cf65e647 100644 --- a/src/components/channelMapper/channelMapper.js +++ b/src/components/channelMapper/channelMapper.js @@ -24,6 +24,7 @@ export default class channelMapper { tunerChannelId: channelId, providerChannelId: providerChannelId }), + contentType: 'application/json', dataType: 'json' }).then(mapping => { const listItem = dom.parentWithClass(button, 'listItem'); diff --git a/src/components/directorybrowser/directorybrowser.js b/src/components/directorybrowser/directorybrowser.js index 4205e04a4..3dd3302b2 100644 --- a/src/components/directorybrowser/directorybrowser.js +++ b/src/components/directorybrowser/directorybrowser.js @@ -169,7 +169,8 @@ import 'emby-button'; data: JSON.stringify({ ValidateWriteable: validateWriteable, Path: path - }) + }), + contentType: 'application/json' }).catch(response => { if (response) { if (response.status === 404) { diff --git a/src/controllers/dashboard/encodingsettings.js b/src/controllers/dashboard/encodingsettings.js index dfad07618..df36ffdc6 100644 --- a/src/controllers/dashboard/encodingsettings.js +++ b/src/controllers/dashboard/encodingsettings.js @@ -48,7 +48,8 @@ import libraryMenu from 'libraryMenu'; data: JSON.stringify({ Path: form.querySelector('.txtEncoderPath').value, PathType: 'Custom' - }) + }), + contentType: 'application/json' }).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure); }); } diff --git a/src/controllers/session/resetPassword/index.js b/src/controllers/session/resetPassword/index.js index 3cb8d4a9e..d4f7df5bb 100644 --- a/src/controllers/session/resetPassword/index.js +++ b/src/controllers/session/resetPassword/index.js @@ -31,7 +31,8 @@ import globalize from 'globalize'; dataType: 'json', data: JSON.stringify({ Pin: view.querySelector('#txtPin').value - }) + }), + contentType: 'application/json' }).then(processForgotPasswordResult); e.preventDefault(); return false; diff --git a/src/controllers/wizard/remote/index.js b/src/controllers/wizard/remote/index.js index 74c795658..b967d668a 100644 --- a/src/controllers/wizard/remote/index.js +++ b/src/controllers/wizard/remote/index.js @@ -12,7 +12,8 @@ function save(page) { apiClient.ajax({ type: 'POST', data: JSON.stringify(config), - url: apiClient.getUrl('Startup/RemoteAccess') + url: apiClient.getUrl('Startup/RemoteAccess'), + contentType: 'application/json' }).then(function () { loading.hide(); navigateToNextPage(); diff --git a/src/controllers/wizard/settings/index.js b/src/controllers/wizard/settings/index.js index 2eaef4fab..12a81ccc3 100644 --- a/src/controllers/wizard/settings/index.js +++ b/src/controllers/wizard/settings/index.js @@ -12,7 +12,8 @@ function save(page) { apiClient.ajax({ type: 'POST', data: JSON.stringify(config), - url: apiClient.getUrl('Startup/Configuration') + url: apiClient.getUrl('Startup/Configuration'), + contentType: 'application/json', }).then(function () { loading.hide(); navigateToNextPage(); diff --git a/src/controllers/wizard/start/index.js b/src/controllers/wizard/start/index.js index 8c147fc75..3cd53b4ce 100644 --- a/src/controllers/wizard/start/index.js +++ b/src/controllers/wizard/start/index.js @@ -18,7 +18,8 @@ function save(page) { apiClient.ajax({ type: 'POST', data: JSON.stringify(config), - url: apiClient.getUrl('Startup/Configuration') + url: apiClient.getUrl('Startup/Configuration'), + contentType: 'application/json' }).then(function () { Dashboard.navigate('wizarduser.html'); }); diff --git a/src/controllers/wizard/user/index.js b/src/controllers/wizard/user/index.js index fc9a27855..ec587fec8 100644 --- a/src/controllers/wizard/user/index.js +++ b/src/controllers/wizard/user/index.js @@ -27,7 +27,8 @@ function submit(form) { Name: form.querySelector('#txtUsername').value, Password: form.querySelector('#txtManualPassword').value }), - url: apiClient.getUrl('Startup/User') + url: apiClient.getUrl('Startup/User'), + contentType: 'application/json' }).then(onUpdateUserComplete); } From c094247988df3db7eed92e5dfaa0434eb45a3095 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 31 Aug 2020 15:58:54 +0200 Subject: [PATCH 2/2] Fix lint error --- src/controllers/wizard/settings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/wizard/settings/index.js b/src/controllers/wizard/settings/index.js index 12a81ccc3..6e3a82cd9 100644 --- a/src/controllers/wizard/settings/index.js +++ b/src/controllers/wizard/settings/index.js @@ -13,7 +13,7 @@ function save(page) { type: 'POST', data: JSON.stringify(config), url: apiClient.getUrl('Startup/Configuration'), - contentType: 'application/json', + contentType: 'application/json' }).then(function () { loading.hide(); navigateToNextPage();