mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:00:55 +00:00
TestToJson bug fixed
This commit is contained in:
parent
422e8285b5
commit
52f8ccd06c
@ -206,10 +206,16 @@ func TestToJson(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
t.Log(ip.Origin)
|
t.Log(ip.Origin)
|
||||||
|
ips := strings.Split(ip.Origin, ",")
|
||||||
if n := strings.Count(ip.Origin, "."); n != 3 {
|
if len(ips) == 0 {
|
||||||
t.Fatal("response is not valid ip")
|
t.Fatal("response is not valid ip")
|
||||||
}
|
}
|
||||||
|
for i := range ips {
|
||||||
|
if net.ParseIP(strings.TrimSpace(ips[i])).To4() == nil {
|
||||||
|
t.Fatal("response is not valid ip")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestToFile(t *testing.T) {
|
func TestToFile(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user