Skip to content

Commit

Permalink
Merge pull request #1139 from eduNEXT/bav/fix-incorrect-post-accept
Browse files Browse the repository at this point in the history
fix: send json accept headers for POST requests
  • Loading branch information
arbrandes authored Oct 22, 2024
2 parents 9c6f247 + 8a4eecf commit 8ce7362
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 8ce7362

Please sign in to comment.