From fadc74d9a92d5822eb0bf01f2e1abee7d8702267 Mon Sep 17 00:00:00 2001 From: jonasholbech Date: Tue, 30 Mar 2021 11:52:24 +0200 Subject: [PATCH] Create fetch.js Vanilla JS did not return the json from the request, the node.js version does, now they should behave the same --- src/targets/javascript/fetch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/targets/javascript/fetch.js b/src/targets/javascript/fetch.js index 3099d7cfa..1ac3ab829 100644 --- a/src/targets/javascript/fetch.js +++ b/src/targets/javascript/fetch.js @@ -65,6 +65,7 @@ module.exports = function (source, options) { code .push(`fetch("${source.fullUrl}", ${JSON.stringify(options, null, opts.indent)})`) + .push('.then(res => res.json())') .push('.then(response => {') .push(1, 'console.log(response);') .push('})')