mirror of
https://github.com/golang/go
synced 2024-11-18 12:54:44 -07:00
Switch http client_test to use google.com/robots.txt to avoid redirect loop.
www.google.com seems to be redirecting requests in an infinite loop. I haven't tracked down whether it's their code or this code that is causing it. This is just a quick fix so that this test passes. APPROVED=r DELTA=4 (0 added, 0 deleted, 4 changed) OCL=30178 CL=30210
This commit is contained in:
parent
61d6ad3178
commit
cbd0092173
@ -16,9 +16,9 @@ import (
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
// TODO: add a proper test suite. Current test merely verifies that
|
||||
// we can retrieve the Google home page.
|
||||
|
||||
r, url, err := Get("http://www.google.com");
|
||||
// we can retrieve the Google robots.txt file.
|
||||
|
||||
r, url, err := Get("http://www.google.com/robots.txt");
|
||||
var b []byte;
|
||||
if err == nil {
|
||||
b, err = io.ReadAll(r.Body);
|
||||
@ -33,8 +33,8 @@ func TestClient(t *testing.T) {
|
||||
t.Errorf("Error fetching URL: %v", err);
|
||||
} else {
|
||||
s := string(b);
|
||||
if (!strings.HasPrefix(s, "<html>")) {
|
||||
t.Errorf("Incorrect page body (did not begin with <html>): %q", s);
|
||||
if (!strings.HasPrefix(s, "User-agent:")) {
|
||||
t.Errorf("Incorrect page body (did not begin with User-agent): %q", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user