Пример #1
0
func TestBuildAuthUrlNoAuth(t *testing.T) {
	url, err := goget.BuildAuthUrl("http://example.com", "", "")
	AssertNil(t, err)

	urlObj, err := http.ParseURL(url)
	AssertNil(t, err)
	AssertEquals(t, "", urlObj.Userinfo)
}
Пример #2
0
func GoGet(url string, resultChan chan string) {
	outfile, err := goget.GetOutfile(url)
	if err != nil {
		fmt.Println("Error determining outfile: " + err.String())
		os.Exit(1)
	}

	authUrl, err := goget.BuildAuthUrl(url, *username, *password)
	if err != nil {
		fmt.Println("Error building auth url: " + err.String())
		os.Exit(1)
	}
	err = goget.FetchUrl(authUrl, outfile)
	if err != nil {
		fmt.Println("Error fetching url: " + err.String())
		os.Exit(1)
	}
	resultChan <- outfile
}