Re: [whatwg/fetch] Add support for blob range requests (PR #1520)

> Thanks, this looks quite clean. I still have a couple inline comments and a longer thought here for a somewhat more substantial change.
> 
> So in principle we can get the type and size from a blob, although unfortunately they are not internal concepts as-of-yet.
> 
> That means we can avoid extracting twice.

Yeah, this makes sense. I didn't change this in order to attempt to keep things closer to how they were before, but we could easily remove the `bodyWithType` steps in the section of the algorithm before the branch.

> It also means we can avoid setting up a new response upfront and can probably have two return statements at the end of the two branches where we create a response and set all its fields as we do now. (They're equivalent, but I kinda like the atomic look of the current setup.)
> 
> We also need only one conditional, whether request contains a `Range` header and the two branches can flow from that. (This is doable either way.)
> 
> Even if editorial, this would be some work. What do you think?

I like the idea of the single return statement using `Blob` [size](https://w3c.github.io/FileAPI/#dfn-size) and [type](https://w3c.github.io/FileAPI/#dfn-type) definitions, but I'm happy to change this if this isn't preferred. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1520#issuecomment-1330945606
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1520/c1330945606@github.com>

Received on Tuesday, 29 November 2022 16:45:59 UTC