65.2%
This commit is contained in:
parent
0fa10daf8d
commit
3a355fdd3a
|
@ -503,7 +503,16 @@ func TestSession_SetBasicAuth(t *testing.T) {
|
||||||
t.Error("code != 200, code = ", resp.GetStatue())
|
t.Error("code != 200, code = ", resp.GetStatue())
|
||||||
}
|
}
|
||||||
|
|
||||||
ses.SetConfig(CBasicAuth, &BasicAuth{User: "eson", Password: "12345"})
|
ses.SetConfig(CBasicAuth, BasicAuth{User: "eson", Password: "12345"})
|
||||||
|
resp, err = ses.Get("http://httpbin.org/basic-auth/eson/123456").Execute()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.GetSrcResponse().StatusCode != 401 {
|
||||||
|
t.Error("code != 401, code = ", resp.GetStatue())
|
||||||
|
}
|
||||||
|
|
||||||
resp, err = ses.Get("http://httpbin.org/basic-auth/eson/123456").Execute()
|
resp, err = ses.Get("http://httpbin.org/basic-auth/eson/123456").Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -521,4 +530,13 @@ func TestSession_SetBasicAuth(t *testing.T) {
|
||||||
if resp.GetSrcResponse().StatusCode != 401 {
|
if resp.GetSrcResponse().StatusCode != 401 {
|
||||||
t.Error("code != 401, code = ", resp.GetStatue())
|
t.Error("code != 401, code = ", resp.GetStatue())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ses.SetConfig(CBasicAuth, nil)
|
||||||
|
resp, err = ses.Get("http://httpbin.org/basic-auth/eson/123456").Execute()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
if resp.GetSrcResponse().StatusCode != 401 {
|
||||||
|
t.Error("code != 401, code = ", resp.GetStatue())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user