Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch: change Response's statusText's default #14144

Merged
merged 1 commit into from Nov 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 17 additions & 16 deletions fetch/api/response/response-init-001.html
Expand Up @@ -15,15 +15,15 @@
"url" : "",
"ok" : true,
"status" : 200,
"statusText" : "OK",
"statusText" : "",
"body" : null
};

var statusCodes = { "givenValues" : [200, 300, 400, 500, 599],
"expectedValues" : [200, 300, 400, 500, 599]
"expectedValues" : [200, 300, 400, 500, 599]
};
var statusTexts = { "givenValues" : ["OK", "with space", String.fromCharCode(0x80)],
"expectedValues" : ["OK", "with space", String.fromCharCode(0x80)]
var statusTexts = { "givenValues" : ["", "OK", "with space", String.fromCharCode(0x80)],
"expectedValues" : ["", "OK", "with space", String.fromCharCode(0x80)]
};
var initValuesDict = { "status" : statusCodes,
"statusText" : statusTexts
Expand All @@ -42,7 +42,7 @@
}, "Check default value for " + attributeName + " attribute");
}

for (var attributeName in initValuesDict)
for (var attributeName in initValuesDict) {
test(function() {
var valuesToTest = initValuesDict[attributeName];
for (var valueIdx in valuesToTest["givenValues"]) {
Expand All @@ -58,19 +58,20 @@
"Expect response.ok is " + isOkStatus(response.status));
}
}, "Check " + attributeName + " init values and associated getter");
}

test(function() {
const response1 = new Response("");
assert_equals(response1.headers, response1.headers);
test(function() {
const response1 = new Response("");
assert_equals(response1.headers, response1.headers);

const response2 = new Response("", {"headers": {"X-Foo": "bar"}});
assert_equals(response2.headers, response2.headers);
const headers = response2.headers;
response2.headers.set("X-Foo", "quux");
assert_equals(headers, response2.headers);
headers.set("X-Other-Header", "baz");
assert_equals(headers, response2.headers);
}, "Test that Response.headers has the [SameObject] extended attribute");
const response2 = new Response("", {"headers": {"X-Foo": "bar"}});
assert_equals(response2.headers, response2.headers);
const headers = response2.headers;
response2.headers.set("X-Foo", "quux");
assert_equals(headers, response2.headers);
headers.set("X-Other-Header", "baz");
assert_equals(headers, response2.headers);
}, "Test that Response.headers has the [SameObject] extended attribute");
</script>
</body>
</html>