diff --git a/lib/network.js b/lib/network.js index 06751a0..387a8f1 100644 --- a/lib/network.js +++ b/lib/network.js @@ -37,7 +37,7 @@ const httpApiCall = async (url, { method = 'POST', headers = {}, body }) => { const mimeType = 'application/json'; const custom = { ...headers, 'Content-Type': mimeType }; const options = { method, body, headers: custom }; - return await fetch(url, options).then((res) => { + return await fetch(url, options).then(async (res) => { const code = res.status; if (code === 200) return res.json(); await res.body.cancel(); diff --git a/test/network.js b/test/network.js index b79efad..26f42be 100644 --- a/test/network.js +++ b/test/network.js @@ -124,7 +124,7 @@ metatests.test('Network: httpApiCall (POST)', async (test) => { const url = `http://localhost:${server.address().port}`; const headers = { 'Custom-Header': 'custom-value' }; - const body = '{"key": "value"}'; + const body = '{"key":"value"}'; const method = 'POST'; try {