summaryrefslogtreecommitdiff
path: root/bilibili/request_test.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-07 10:18:55 +0800
committerKeuin <[email protected]>2022-09-07 10:18:55 +0800
commitc72e692be33d5ab2884db6e2f1cf027f150a108a (patch)
tree170ea1989d215d0fede3f762f344bfb55e4c3fb3 /bilibili/request_test.go
parent2033d66ce1fcbd6b5be00f35f9f2e1c07b5a8ba7 (diff)
Bugfix: callGet[T] will panic if the request is unsuccessful
Diffstat (limited to 'bilibili/request_test.go')
-rw-r--r--bilibili/request_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/bilibili/request_test.go b/bilibili/request_test.go
new file mode 100644
index 0000000..68e5c7a
--- /dev/null
+++ b/bilibili/request_test.go
@@ -0,0 +1,14 @@
+package bilibili
+
+import (
+ "testing"
+)
+
+func Test_callGet(t *testing.T) {
+ // an always-fail request should not panic
+ bi := NewBilibili()
+ _, err := callGet[BaseResponse[struct{}]](bi, "https://256.256.256.256")
+ if err == nil {
+ t.Fatalf("the artificial request should fail, but it haven't")
+ }
+}