Files
go-flaresolverr/test/flaresolverr_test.go
T

70 lines
1.4 KiB
Go

package test
import (
"testing"
"git.nite07.com/nite/go-flaresolverr/v2"
)
func TestGetV1(t *testing.T) {
f, err := flaresolverr.GetInstance(
"http://10.10.10.1:8191",
flaresolverr.WithProxy("socks5://10.10.10.1:7900"),
)
if err != nil {
t.Error(err)
return
}
resp, err := f.GetV1("https://steamrip.com/games-list-page/", 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://steamrip.com/games-list-page/", 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 := resp2.Bytes()
t.Log(string(body))
}
func TestGetV1_2(t *testing.T) {
f, err := flaresolverr.GetInstance(
"http://10.10.10.1:8191",
flaresolverr.WithProxy("socks5://10.10.10.1:7900"),
)
if err != nil {
t.Error(err)
return
}
resp, err := f.GetV1("https://1337x.to", 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://1337x.to/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 := resp2.Bytes()
t.Log(string(body))
}