37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package cwclient
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func TestPort(t *testing.T) {
|
|
cli := New("http://localhost:7123")
|
|
|
|
ltest := cli.Register("test", func(cxt *CallbackContext) {
|
|
if cxt.Error != nil {
|
|
log.Println("error:", cxt.Error)
|
|
} else {
|
|
log.Println(cxt.TaskID, cxt.Content, cxt.Carry)
|
|
}
|
|
})
|
|
|
|
ltest.SetContentConditionFromFile("example.js")
|
|
cli.Connect()
|
|
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser", nil))
|
|
// log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser", "213"))
|
|
// log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"))
|
|
// log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser"))
|
|
http.ListenAndServe(":4233", nil)
|
|
}
|
|
|
|
func TestChrome(t *testing.T) {
|
|
|
|
var a = make(map[string]interface{})
|
|
a["as"] = 123
|
|
data, _ := json.Marshal(a["as"])
|
|
log.Println(string(data), a["as"])
|
|
}
|