summaryrefslogtreecommitdiff
path: root/js/fetch_test.ts
diff options
context:
space:
mode:
authorztplz <mysticzt@gmail.com>2018-10-22 05:42:18 +0800
committerRyan Dahl <ry@tinyclouds.org>2018-10-21 14:42:18 -0700
commitc4bddc4651f583241193b80634a4f22abb02d582 (patch)
treef70a819bd2bd26b80132f2821943b2e5fffb8861 /js/fetch_test.ts
parent47c96a61527f56aa6dfc5a8fc44b13a1db4f4da5 (diff)
Implemente clone for FetchResponse (#1054)
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r--js/fetch_test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/fetch_test.ts b/js/fetch_test.ts
index 2ef58f273..2f73544aa 100644
--- a/js/fetch_test.ts
+++ b/js/fetch_test.ts
@@ -44,6 +44,19 @@ testPerm({ net: true }, async function fetchBlob() {
assertEqual(blob.size, Number(headers.get("Content-Length")));
});
+testPerm({ net: true }, async function responseClone() {
+ const response = await fetch("http://localhost:4545/package.json");
+ const response1 = response.clone();
+ assert(response !== response1);
+ assertEqual(response.status, response1.status);
+ assertEqual(response.statusText, response1.statusText);
+ const ab = await response.arrayBuffer();
+ const ab1 = await response1.arrayBuffer();
+ for (let i = 0; i < ab.byteLength; i++) {
+ assertEqual(ab[i], ab1[i]);
+ }
+});
+
// Logic heavily copied from web-platform-tests, make
// sure pass mostly header basic test
/* tslint:disable-next-line:max-line-length */