Skip to content

Commit

Permalink
Merge pull request #1145 from eduNEXT/MJG/backport-1139
Browse files Browse the repository at this point in the history
fix: send json accept headers for POST requests
  • Loading branch information
cmltaWt0 authored Oct 23, 2024
2 parents 5219606 + 75ba8f1 commit 02f5bba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/account-settings/site-language/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ export async function patchPreferences(username, params) {

export async function postSetLang(code) {
const formData = new FormData();
const requestConfig = {
headers: {
Accept: 'application/json',
'X-Requested-With': 'XMLHttpRequest',
},
};
const url = `${getConfig().LMS_BASE_URL}/i18n/setlang/`;
formData.append('language', code);

await getAuthenticatedHttpClient()
.post(`${getConfig().LMS_BASE_URL}/i18n/setlang/`, formData, {
headers: { 'X-Requested-With': 'XMLHttpRequest' },
});
.post(url, formData, requestConfig);
}
3 changes: 2 additions & 1 deletion src/account-settings/third-party-auth/data/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ export async function getThirdPartyAuthProviders() {
}

export async function postDisconnectAuth(url) {
const requestConfig = { headers: { Accept: 'application/json' } };
const { data } = await getAuthenticatedHttpClient()
.post(url)
.post(url, {}, requestConfig)
.catch(handleRequestError);
return data;
}

0 comments on commit 02f5bba

Please sign in to comment.