You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[...] the type of a Blob as an ASCII-encoded string in lower case, such that when it is converted to a byte sequence, it is a parsable MIME type, or the empty string – 0 bytes – if the type cannot be determined.
Based on my reading of this, I'd expect that a fetch of blob created with an invalid mime type for type would result in the Content-Type set to the empty string (similar to a blob created without a input type #1436).
Given the following test:
diff --git a/fetch/api/basic/scheme-blob.sub.any.js b/fetch/api/basic/scheme-blob.sub.any.js
index a6059ea93d..8afdc033c9 100644
--- a/fetch/api/basic/scheme-blob.sub.any.js
+++ b/fetch/api/basic/scheme-blob.sub.any.js
@@ -57,6 +57,10 @@ let empty_data_blob = new Blob([], {type: "text/plain"});
checkFetchResponse(URL.createObjectURL(empty_data_blob), "", "text/plain", 0,
"Fetching URL.createObjectURL(empty_data_blob) is OK");
+let invalid_type_blob = new Blob([], {type: "invalid"});
+checkFetchResponse(URL.createObjectURL(invalid_type_blob), "", "", 0,
+ "Fetching URL.createObjectURL(invalid_type_blob) is OK");
+
promise_test(function(test) {
return fetch("/images/blue.png").then(function(resp) {
return resp.arrayBuffer();
I get the following results:
Browser
Content-Type
Firefox
"application/x-unknown-content-type"
Chrome
"invalid"
Safari
"invalid"
The text was updated successfully, but these errors were encountered:
Yeah, I think the correct long term answer here is that blobs have an internal type slot that is either a MIME type or null. When Fetch serializes that it either gets a valid MIME type or the empty byte sequence.
(At least, I think elsewhere we already settled on using the empty byte sequence as Content-Type value. And while that's not great, it's also not the worst. Certainly much better than invalid.)
From File API - Blob.type:
Based on my reading of this, I'd expect that a fetch of blob created with an invalid mime type for
type
would result in theContent-Type
set to the empty string (similar to a blob created without a input type #1436).Given the following test:
I get the following results:
"application/x-unknown-content-type"
"invalid"
"invalid"
The text was updated successfully, but these errors were encountered: