mirror of
https://gitee.com/energye/energy.git
synced 2024-12-11 05:01:18 +08:00
35 lines
716 B
Go
35 lines
716 B
Go
package cef
|
|
|
|
import (
|
|
"bytes"
|
|
"log"
|
|
"net/http"
|
|
"testing"
|
|
)
|
|
|
|
func TestXHRProxyClientSSLSend(t *testing.T) {
|
|
proxy := &XHRProxy{
|
|
IP: "energy.yanghy.cn",
|
|
}
|
|
proxy.init()
|
|
httpRequest, err := http.NewRequest("GET", "https://energy.yanghy.cn/api/energy/download", nil)
|
|
if err != nil {
|
|
log.Println("new request:", err.Error())
|
|
return
|
|
}
|
|
httpResponse, err := proxy.HttpClient.Client.Do(httpRequest)
|
|
if err != nil {
|
|
log.Println("do:", err.Error())
|
|
return
|
|
}
|
|
defer httpResponse.Body.Close()
|
|
buf := new(bytes.Buffer)
|
|
c, err := buf.ReadFrom(httpResponse.Body)
|
|
if err != nil {
|
|
log.Println("read from:", err.Error())
|
|
return
|
|
}
|
|
log.Println(c, err, httpResponse.StatusCode)
|
|
log.Println(buf.String())
|
|
}
|