From 8e15d802865ed57db0018c15ea5559c8bd44c01f Mon Sep 17 00:00:00 2001 From: Keuin Date: Wed, 7 Sep 2022 02:48:46 +0800 Subject: First working version. Just a POC. --- bilibili/util.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bilibili/util.go (limited to 'bilibili/util.go') diff --git a/bilibili/util.go b/bilibili/util.go new file mode 100644 index 0000000..1267a39 --- /dev/null +++ b/bilibili/util.go @@ -0,0 +1,13 @@ +package bilibili + +import ( + "fmt" + "net/http" +) + +func validateHttpStatus(r *http.Response) (err error) { + if code := r.StatusCode; code != http.StatusOK { + err = fmt.Errorf("unsuccessful HTTP status on API %v: %v", r.Request.URL, code) + } + return +} -- cgit v1.2.3