summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-09-11 23:34:22 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-09-11 17:34:22 -0400
commit945dc7b84bc1a05f80b3b4e0b152be38d9f8a9bf (patch)
tree7c0fe4d779e5ee5f3e5de63a72b4369268165667 /js
parent82dc1b8e59891a7ca0f1a5e67a3db952b918561c (diff)
fix: panic during fetch (#2925)
Diffstat (limited to 'js')
-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 77cc010a8..4fcc39f01 100644
--- a/js/fetch_test.ts
+++ b/js/fetch_test.ts
@@ -4,9 +4,22 @@ import {
testPerm,
assert,
assertEquals,
+ assertStrContains,
assertThrows
} from "./test_util.ts";
+testPerm({ net: true }, async function fetchConnectionError(): Promise<void> {
+ let err;
+ try {
+ await fetch("http://localhost:4000");
+ } catch (err_) {
+ err = err_;
+ }
+ assertEquals(err.kind, Deno.ErrorKind.HttpOther);
+ assertEquals(err.name, "HttpOther");
+ assertStrContains(err.message, "error trying to connect");
+});
+
testPerm({ net: true }, async function fetchJsonSuccess(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const json = await response.json();