Use fetch instead of XMLHttpRequest in weatherprovider (#2935)

small update to the fetchData method to use the fetch helper instead of
the old XCMLHttpRequest.
Also fixes some typos :-)

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck 2022-10-06 19:44:16 +02:00 committed by GitHub
parent a86e27a12c
commit d5e855dd6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 54 deletions

View file

@ -5,7 +5,7 @@
* @param {object} options object e.g. for headers
* @class
*/
async function fetch(url, options) {
async function fetch(url, options = {}) {
const nodeVersion = process.version.match(/^v(\d+)\.*/)[1];
if (nodeVersion >= 18) {
// node version >= 18