remove simulate request methods
This commit is contained in:
@@ -2,11 +2,9 @@ package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.nite07.com/nite/go-flaresolverr"
|
||||
"github.com/Danny-Dasilva/CycleTLS/cycletls"
|
||||
)
|
||||
|
||||
func TestGetV1(t *testing.T) {
|
||||
@@ -27,37 +25,3 @@ func TestGetV1(t *testing.T) {
|
||||
t.Log(string(jsonBytes))
|
||||
}
|
||||
}
|
||||
|
||||
func TestImitateGet(t *testing.T) {
|
||||
f, err := flaresolverr.GetInstance("http://100.64.0.1:8191", "", "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := f.GetV1("https://nopecha.com/demo/cloudflare", nil) // get cf-clearance cookie
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp.Solution.Status != 200 {
|
||||
t.FailNow()
|
||||
}
|
||||
cookies := resp.Solution.Cookies
|
||||
resp1, err := f.SimulateGet("https://nopecha.com/demo/cloudflare", &flaresolverr.SimulateOptions{
|
||||
HttpCookies: cookies,
|
||||
Options: cycletls.Options{
|
||||
ForceHTTP3: true,
|
||||
},
|
||||
}) // ImitateGet uses cookies to simulate browser requests and also simulates the browser's ja3 fingerprint.
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp1.Status != 200 {
|
||||
fmt.Printf("status is not 200: %v", resp1.Status)
|
||||
fmt.Printf("%+v", resp1)
|
||||
t.FailNow()
|
||||
}
|
||||
jsonBytes, _ := json.Marshal(resp1)
|
||||
t.Log(string(jsonBytes))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user