diff --git a/src/assets/js/main.js b/src/assets/js/main.js index 4e25e14..b4a9900 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -26,14 +26,18 @@ async function readResponse(response) { const decoder = new TextDecoder('utf-8'); try { - // Recursive function to read the stream - reader.read().then(( done, value ) => { - console.log(`Done: ${done}`); - console.log(`Value: ${value}`); - if (done) { - return; - } - }); + function read() { + // Recursive function to read the stream + reader.read().then(( done, value ) => { + console.log(`Done: ${JSON.stringify(done)}`); + console.log(`Value: ${new TextDecoder().decode(value)}`); + if (done) { + return; + } + read(); + }); + } + read(); } catch (error) { outputArea.innerHTML = `Error: ${error.message}`; }