Esempio n. 1
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
}
Esempio n. 2
0
func TestGetOutfileDefault2(t *testing.T) {
	outfile, err := goget.GetOutfile("http://example.com")
	AssertNil(t, err)
	AssertEquals(t, "index.html", outfile)
}
Esempio n. 3
0
func TestGetOutfileCompound(t *testing.T) {
	outfile, err := goget.GetOutfile("http://example.com/path/to/file.mp3")
	AssertNil(t, err)
	AssertEquals(t, "file.mp3", outfile)
}