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

@@ -512,6 +512,9 @@ var BaseAPI = /*#__PURE__*/function () {
}
return result;
},
requestHandler: function requestHandler(commitObject) {
return commitObject;
}
}
});
@@ -1611,6 +1614,8 @@ var BaseAPI = /*#__PURE__*/function () {
}
try {
params = settings.requestHandler(params);
if (params instanceof Array) {
httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpReq.send(params.join('&'));