Merge pull request #20823 from Snuffleupagus/Response-bytes-more

Use `Response.prototype.bytes()` more in the code-base (PR 20651 follow-up)
This commit is contained in:
Tim van der Meij 2026-03-07 18:40:00 +01:00 committed by GitHub
commit 897e53838d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 6 deletions

View File

@ -29,7 +29,7 @@ const response = await fetch(JPEG_IMAGE);
if (!response.ok) {
throw new Error(response.statusText);
}
const typedArrayImage = new Uint8Array(await response.arrayBuffer());
const typedArrayImage = await response.bytes();
// Parse the image data using `JpegImage`.
//

View File

@ -85,8 +85,7 @@ async function writeStream(stream, buffer, transform) {
.catch(() => {});
// Response::text doesn't return the correct data.
const buf = await new Response(cs.readable).arrayBuffer();
bytes = new Uint8Array(buf);
bytes = await new Response(cs.readable).bytes();
let newFilter, newParams;
if (!filter) {

View File

@ -746,9 +746,7 @@ class SignatureExtractor {
writer.close();
const buf = await new Response(cs.readable).arrayBuffer();
const bytes = new Uint8Array(buf);
const bytes = await new Response(cs.readable).bytes();
return bytes.toBase64();
}