HTTP download test pass

This commit is contained in:
liwei committed 2019-05-05 01:23:48 +08:00
1 parent 00468e4e4a
commit 66a4b022f2
7 files changed
+180 -118

No files matched your search

+19 -21
View File
@@ -1,26 +1,24 @@
package main
import "github.com/zserge/webview"
import "github.com/getlantern/systray"
import (
"fmt"
"gee-download/down"
)
func main() {
systray.Run(onReady,onExit)
// Open wikipedia in a 800x600 resizable window
webview.Open("Minimal webview example",
"https://www.baidu.com", 800, 600, true)
httpRequest, _ := down.BuildHTTPRequest(&down.Request{
Method: "get",
URL: "http://github.com/proxyee-down-org/proxyee-down/releases/download/3.4/proxyee-down-main.jar",
Header: map[string]string{
"Host": "github.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Referer": "http://github.com/proxyee-down-org/proxyee-down/releases",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
},
})
got, _ := down.Resolve(*httpRequest)
fmt.Println(got)
// webview.Open("Minimal webview example", "https://www.baidu.com", 800, 600, true)
}
func onReady() {
systray.SetIcon(icon.Data)
systray.SetTitle("Awesome App")
systray.SetTooltip("Pretty awesome超级棒")
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
// Sets the icon of a menu item. Only available on Mac.
mQuit.SetIcon(icon.Data)
}
func onExit() {
// clean up here
}