Index: LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
diff --git a/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
index e133b7f57570d83cd347073f5d919ece45f51ca2..c97b0c82f9ead7e14fa57e4b9c3c75eabed6de41 100644 |
--- a/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
+++ b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
@@ -101,3 +101,32 @@ promise_test(function() { |
'Response clone response body text should match.'); |
}); |
}, 'Behavior of bodyUsed in Response and clone behavior.'); |
+ |
+promise_test(function() { |
+ var response = new Response(null); |
+ assert_equals( |
+ response.headers.get('Content-Type'), |
+ 'text/plain;charset=UTF-8', |
+ 'A Response constructed with a value coerced to string should have a ' + |
+ 'text Content-Type.'); |
+ return response.text() |
+ .then(function(text) { |
+ assert_equals(text, 'null', |
+ 'A null value passed to Response constructor should ' + |
+ 'be coerced to the string "null".'); |
+ }); |
+ }, 'Behavior of Response passed null for body.'); |
+ |
+promise_test(function() { |
+ var response = new Response(); |
+ assert_equals( |
+ response.headers.get('Content-Type'), |
+ null, |
+ 'A Response constructed with no body should have no Content-Type.'); |
+ return response.text() |
+ .then(function(text) { |
+ assert_equals(text, '', |
+ 'Response with no body accessed as text should ' + |
+ 'resolve to the empty string.'); |
+ }); |
+ }, 'Behavior of Response with no body.'); |