1 Star 0 Fork 53

SmartFire / smscode

forked from xluohome / smscode 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
callback_test.go 618 Bytes
一键复制 编辑 原始数据 按行查看 历史
xluo 提交于 2017-02-18 18:52 . v0.13beta
package main
import (
"net/http"
"testing"
)
func TestNewCallback(t *testing.T) {
wating := make(chan bool)
var fun = func(w http.ResponseWriter, r *http.Request) {
t.Log("mobile:", r.FormValue("mobile"), "code:", r.FormValue("code"), "uxtime:", r.FormValue("uxtime"))
w.Write([]byte("ok"))
wating <- true
}
go func() {
http.HandleFunc("/test", fun)
http.ListenAndServe("127.0.0.1:8080", nil)
}()
sms := NewSms()
sms.SetServiceConfig("register")
sms.Mobile = "13575566313"
sms.Code = "999999"
sms.Config.Callback = "http://127.0.0.1:8080/test"
AddCallbackTask(sms, "test")
<-wating
}
Go
1
https://gitee.com/smartfire/smscode.git
git@gitee.com:smartfire/smscode.git
smartfire
smscode
smscode
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891