add web gui
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
package constants
|
||||
|
||||
const Version = "0.0.2"
|
||||
const Version = "0.0.3"
|
||||
|
||||
const ApiVersion = 1
|
||||
|
||||
@@ -36,7 +36,8 @@ type (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotFound error = errors.New("not found")
|
||||
ErrNotFound error = errors.New("not found")
|
||||
ErrUnauthorized error = errors.New("unauthorized (HTTP Error 401)")
|
||||
)
|
||||
|
||||
func New(baseURL, username, password string) *Client {
|
||||
@@ -382,6 +383,10 @@ func (c *Client) get(url string) (obj.HTTPObject, error) {
|
||||
return obj.HTTPObject{}, ErrNotFound
|
||||
}
|
||||
|
||||
if res.StatusCode == 401 {
|
||||
return obj.HTTPObject{}, ErrUnauthorized
|
||||
}
|
||||
|
||||
if res.StatusCode != 200 {
|
||||
return obj.HTTPObject{}, fmt.Errorf("server returns an unexpected status code: %d %s (expected 200)", res.StatusCode, res.Status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user