Stringify params before sending to LMS

This commit is contained in:
Jonathan Putney
2019-11-19 14:17:35 -05:00
parent 5c46dea6d9
commit fa184a3245
4 changed files with 8 additions and 8 deletions

View File

@@ -870,15 +870,15 @@ export default class BaseAPI {
const httpReq = new XMLHttpRequest();
httpReq.open('POST', url, false);
httpReq.setRequestHeader('Content-Type',
this.settings.commitRequestDataType);
try {
if (params instanceof Array) {
httpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
httpReq.send(params.join('&'));
} else {
httpReq.send(params);
httpReq.setRequestHeader('Content-Type',
this.settings.commitRequestDataType);
httpReq.send(JSON.stringify(params));
}
} catch (e) {
return genericError;