From 94e40fd2629642d4e32fceeb6aab1edf4c29458c Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sat, 19 Aug 2023 18:12:10 +0800 Subject: [PATCH] Remove useless checks --- casdoorsdk/email.go | 12 ++---------- casdoorsdk/resource.go | 8 -------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/casdoorsdk/email.go b/casdoorsdk/email.go index 895c855..ea4c539 100644 --- a/casdoorsdk/email.go +++ b/casdoorsdk/email.go @@ -14,10 +14,7 @@ package casdoorsdk -import ( - "encoding/json" - "fmt" -) +import "encoding/json" type emailForm struct { Title string `json:"title"` @@ -38,14 +35,9 @@ func (c *Client) SendEmail(title string, content string, sender string, receiver return err } - resp, err := c.DoPost("send-email", nil, postBytes, false, false) + _, err = c.DoPost("send-email", nil, postBytes, false, false) if err != nil { return err } - - if resp.Status != "ok" { - return fmt.Errorf(resp.Msg) - } - return nil } diff --git a/casdoorsdk/resource.go b/casdoorsdk/resource.go index 5ba8c6a..b6ff362 100644 --- a/casdoorsdk/resource.go +++ b/casdoorsdk/resource.go @@ -132,10 +132,6 @@ func (c *Client) UploadResource(user string, tag string, parent string, fullFile return "", "", err } - if resp.Status != "ok" { - return "", "", fmt.Errorf(resp.Msg) - } - fileUrl := resp.Data.(string) name := resp.Data2.(string) return fileUrl, name, nil @@ -158,10 +154,6 @@ func (c *Client) UploadResourceEx(user string, tag string, parent string, fullFi return "", "", err } - if resp.Status != "ok" { - return "", "", fmt.Errorf(resp.Msg) - } - fileUrl := resp.Data.(string) name := resp.Data2.(string) return fileUrl, name, nil