Files
go-flaresolverr/test/flaresolverr_test.go
2026-01-26 03:42:39 +08:00

41 lines
797 B
Go

package test
import (
"io"
"testing"
"git.nite07.com/nite/go-flaresolverr"
)
func TestGetV1(t *testing.T) {
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://x1337x.cc/", nil)
if err != nil {
t.Error(err)
return
}
if resp.Solution.Status != 200 {
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))
}