blob: 0ed03ba9b4edc7a7734b09a101f171af5171688e [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Consuming Request body after getting a ReadableStream</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function createRequestWithLockedReadableStream(callback) {
var request = new Request("", {body: "{\"key\": \"value\"}", method: "POST"});
var reader = request.body.getReader();
return callback(request);
}
promise_test(function(test) {
return createRequestWithLockedReadableStream(function(request) {
return promise_rejects(test, new TypeError(), request.blob());
});
}, "Getting blob after getting a locked Request body");
promise_test(function(test) {
return createRequestWithLockedReadableStream(function(request) {
return promise_rejects(test, new TypeError(), request.text());
});
}, "Getting text after getting a locked Request body");
promise_test(function(test) {
return createRequestWithLockedReadableStream(function(request) {
return promise_rejects(test, new TypeError(), request.json());
});
}, "Getting json after getting a locked Request body");
promise_test(function(test) {
return createRequestWithLockedReadableStream(function(request) {
return promise_rejects(test, new TypeError(), request.arrayBuffer());
});
}, "Getting arrayBuffer after getting a locked Request body");
</script>
</body>
</html>