Sunday, October 8, 2023
1 change · master
Miscellaneous changes
As `download`, the `downloadFile` util is able to perform an `XMLHttpRequest` (`GET`) if it is provided with only an url. Change the return value of `downloadFile` in that case to a `Promise`, to match the behavior of `download`. Previously, the `XMLHttpRequest` was returned to allow the caller to modify the headers of the request, but that feature was not used. Extract the configuration of the `XMLHttpRequest` for `download` to a separate function so it can be used for both `download` a
Original PR description
As `download`, the `downloadFile` util is able to perform an `XMLHttpRequest` (`GET`) if it is provided with only an url. Change the return value of `downloadFile` in that case to a `Promise`, to match the behavior of `download`. Previously, the `XMLHttpRequest` was returned to allow the caller to modify the headers of the request, but that feature was not used. Extract the configuration of the `XMLHttpRequest` for `download` to a separate function so it can be used for both `download` and `downloadFile`. It will set the `responseType, onload, onerror` properties. Tracking: - usage of `downloadFile` in Knowledge introduced in [1]. [1]: https://github.com/odoo/enterprise/pull/47056 task-3517796 X-original-commit: https://github.com/odoo/odoo/commit/787f207f9882807598273c34296d0c1d8081f1b5