u
This commit is contained in:
@@ -1,27 +1,40 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"git.nite07.com/nite/go-flaresolverr"
|
||||
)
|
||||
|
||||
func TestGetV1(t *testing.T) {
|
||||
f, err := flaresolverr.GetInstance("http://100.64.0.1:8191", "", "")
|
||||
f, err := flaresolverr.GetInstance("http://10.10.10.1:8191", "", "socks5://10.10.10.1:7900")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := f.GetV1("https://nopecha.com/demo/cloudflare", nil)
|
||||
resp, err := f.GetV1("https://x1337x.cc/", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp.Solution.Status != 200 {
|
||||
t.Fail()
|
||||
} else {
|
||||
jsonBytes, _ := json.Marshal(resp)
|
||||
t.Log(string(jsonBytes))
|
||||
t.Error("status code != 200", resp.Solution.Status)
|
||||
return
|
||||
}
|
||||
resp2, err := f.SimulateGet("https://x1337x.cc/user/FitGirl/", resp.Solution.UserAgent, resp.Solution.Cookies)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp2.StatusCode != 200 {
|
||||
t.Error("status code != 200", resp2.StatusCode)
|
||||
return
|
||||
}
|
||||
body, err := io.ReadAll(resp2.Body)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(string(body))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user