mirror of
https://github.com/zxbit2011/hikvisionOpenAPIGo.git
synced 2025-10-05 15:36:48 +08:00
fix: remove panic
This commit is contained in:
2
sdk.go
2
sdk.go
@@ -103,7 +103,7 @@ func (hk HKConfig) HttpPost(url string, body map[string]string, timeout int) (re
|
|||||||
err = json.Unmarshal(resBody, &result)
|
err = json.Unmarshal(resBody, &result)
|
||||||
} else if resp.StatusCode == http.StatusFound || resp.StatusCode == http.StatusMovedPermanently {
|
} else if resp.StatusCode == http.StatusFound || resp.StatusCode == http.StatusMovedPermanently {
|
||||||
reqUrl := resp.Header.Get("Location")
|
reqUrl := resp.Header.Get("Location")
|
||||||
panic(fmt.Errorf("HttpPost Response StatusCode:%d,Location:%s", resp.StatusCode, reqUrl))
|
err = fmt.Errorf("HttpPost Response StatusCode:%d,Location:%s", resp.StatusCode, reqUrl)
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("HttpPost Response StatusCode:%d", resp.StatusCode)
|
err = fmt.Errorf("HttpPost Response StatusCode:%d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user