- From: Jimmy Wärting <notifications@github.com>
- Date: Wed, 10 Aug 2022 12:31:21 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 10 August 2022 19:31:36 UTC
Hmm, saw some integrity question earlier on an other repo. i really thought that it was possible to process the readable stream before integrity was even calculated, that it would just throw an error at the very end of the stream if it did not match instead of successfully closing the stream. is this how we want it to work really? ```js // this only console logs 1 final chunk fetch('https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.2/p5.min.js', { integrity: 'sha512-rCZdHNB0AePry6kAnKAVFMRfWPmUXSo+/vlGtrOUvhsxD0Punm/xWbEh+8vppPIOzKB9xnk42yCRZ5MD/jvvjQ==' }).then(res => { const reader = res.body.getReader() function pump() { reader.read().then(val => { console.log(val) if (!val.done) pump() }) } pump() }) // where as this logs multiple times fetch('https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.2/p5.min.js').then(res => { const reader = res.body.getReader() function pump() { reader.read().then(val => { console.log(val) if (!val.done) pump() }) } pump() }) ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/661#issuecomment-1211175559 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/661/1211175559@github.com>
Received on Wednesday, 10 August 2022 19:31:36 UTC