Skip to content

Commit

Permalink
wpt: update scheme-blob.sub.any.js (nodejs#1731)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and crysmags committed Feb 27, 2024
1 parent 18c5353 commit 40c1ff0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
6 changes: 0 additions & 6 deletions test/wpt/status/fetch.status.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
"Object.prototype.highWaterMark accessor returning invalid value should not affect stream creation by 'fetch'"
]
},
"scheme-blob.sub.any.js": {
"fail": [
"Set content type to the empty string for slice with invalid content type",
"Set content type to the empty string for slice with no content type "
]
},
"header-value-combining.any.js": {
"fail": [
"response.headers.get('content-length') expects 0, 0",
Expand Down
17 changes: 9 additions & 8 deletions test/wpt/tests/fetch/api/basic/scheme-blob.sub.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,32 @@ let xml_blob_no_type = new Blob([simple_xml_string]);
checkFetchResponse(URL.createObjectURL(xml_blob_no_type), simple_xml_string, "", 45,
"Blob content is not sniffed for a content type [text/xml]");

let simple_text_string = 'Hello, World!';
promise_test(function(test) {
let blob = new Blob([], {"type": "text/plain"});
let slice = blob.slice(8, 25, "\0");
let blob = new Blob([simple_text_string], {"type": "text/plain"});
let slice = blob.slice(7, simple_text_string.length, "\0");
return fetch(URL.createObjectURL(slice)).then(function (resp) {
assert_equals(resp.status, 200, "HTTP status is 200");
assert_equals(resp.type, "basic", "response type is basic");
assert_equals(resp.headers.get("Content-Type"), "");
assert_equals(resp.headers.get("Content-Length"), "17");
assert_equals(resp.headers.get("Content-Length"), "6");
return resp.text();
}).then(function(bodyAsText) {
assert_equals(bodyAsText, "type with invalid");
assert_equals(bodyAsText, "World!");
});
}, "Set content type to the empty string for slice with invalid content type");

promise_test(function(test) {
let blob = new Blob([], {"type": "text/plain"});
let slice = blob.slice(8, 20);
let blob = new Blob([simple_text_string], {"type": "text/plain"});
let slice = blob.slice(7, simple_text_string.length, "\0");
return fetch(URL.createObjectURL(slice)).then(function (resp) {
assert_equals(resp.status, 200, "HTTP status is 200");
assert_equals(resp.type, "basic", "response type is basic");
assert_equals(resp.headers.get("Content-Type"), "");
assert_equals(resp.headers.get("Content-Length"), "12");
assert_equals(resp.headers.get("Content-Length"), "6");
return resp.text();
}).then(function(bodyAsText) {
assert_equals(bodyAsText, "type that is");
assert_equals(bodyAsText, "World!");
});
}, "Set content type to the empty string for slice with no content type ");

Expand Down

0 comments on commit 40c1ff0

Please sign in to comment.