[whatwg/fetch] blob() method: define behavior when get the MIME type return null (Issue #1802)

### What is the issue with the Fetch Standard?

In the [blob() method](https://fetch.spec.whatwg.org/#dom-body-blob):

> The blob() method steps are to return the result of running consume body with this and the following step given a byte sequence bytes: return a Blob whose contents are bytes and whose type attribute is the result of get the MIME type with this.

If [get the MIME type](https://fetch.spec.whatwg.org/#concept-body-mime-type) return a null value when it failed to extracting a MIME type from headers:

> To get the MIME type, given a Request or Response object requestOrResponse:
> 4. Let mimeType be the result of extracting a MIME type from headers.
> 5. If mimeType is failure, then return null.
> 6. Return mimeType.  

I think In `blob()` method we need to either set type to an empty string or throw a TypeError like `formData()` does.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1802
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1802@github.com>

Received on Friday, 17 January 2025 04:52:48 UTC