Closed dlrobertson closed 2 years ago
But slice.type === ''
, correct? Isn't the behavior identical for blobs created with an explicit empty/non-valid contentType?
Don't your tests end up being more about what the Fetch API returns for blob URLs when the Blob's type is an empty string?
I haven't stared at Fetch enough, but it does seem inconsistent - to get a header name should only return null if the header list does not contain the header, yet the "blob" fetch algorithm unconditionally appends Content-Type with the blob’s type. It may be that Fetch needs to define an attempt to parse the type, and on failure not append. Consider filing a bug against Fetch?
But slice.type === '', correct? Isn't the behavior identical for blobs created with an explicit empty/non-valid contentType?
Ah! You're right! Didn't think to check this. slice.type
is correct, but the header is not.
Based on my reading of blob.slice(), it seems that the resulting blobs content type should be the empty string under the following cases:
1)
contentType
is not given 2)contentType
has a value outside the range of U+0020 to U+007EAfter writing a simple wpt test, it seems like no browser does 1 and only one does 2.
contentType
contentType
Just in case the issue is actually my test cases 😄, I've attached the example I used below: