fix 301 response missing Location header
error
This commit is contained in:
parent
15855ca0f2
commit
4fa5d04fb4
@ -85,6 +85,10 @@ func (c *Caller) GetLoginInfo(body []byte) (*LoginInfo, error) {
|
|||||||
|
|
||||||
resp := NewReturnResponse(c.Client.GetLoginInfo(path.String()))
|
resp := NewReturnResponse(c.Client.GetLoginInfo(path.String()))
|
||||||
if resp.Err() != nil {
|
if resp.Err() != nil {
|
||||||
|
uErr, ok := resp.Err().(*url.Error)
|
||||||
|
if ok && (uErr.Err.Error() == missLocationHeader.Error()) {
|
||||||
|
return nil, loginForbiddenError
|
||||||
|
}
|
||||||
return nil, resp.Err()
|
return nil, resp.Err()
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
@ -51,6 +51,8 @@ const (
|
|||||||
// errors
|
// errors
|
||||||
var (
|
var (
|
||||||
noSuchUserFoundError = errors.New("no such user found")
|
noSuchUserFoundError = errors.New("no such user found")
|
||||||
|
missLocationHeader = errors.New("301 response missing Location header")
|
||||||
|
loginForbiddenError = errors.New("login forbidden")
|
||||||
)
|
)
|
||||||
|
|
||||||
// ALL跟search函数搭配
|
// ALL跟search函数搭配
|
||||||
|
Loading…
x
Reference in New Issue
Block a user