Add a requestHandler setting to BaseAPI.

It mirrors `responseHandler` and it's useful for the same reason:
to be able to adapt the data sent to the LMS.
This commit is contained in:
Rubén Herrero
2022-02-11 08:49:37 +01:00
parent 96337bf2fb
commit be11f4d0b6
10 changed files with 49 additions and 4 deletions

View File

@@ -48,6 +48,9 @@ export default class BaseAPI {
}
return result;
},
requestHandler: function(commitObject) {
return commitObject;
},
};
cmi;
startingData: {};
@@ -1114,6 +1117,7 @@ export default class BaseAPI {
};
}
try {
params = settings.requestHandler(params);
if (params instanceof Array) {
httpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');