Commit 1a8bd671 authored by Andrew Gerrand's avatar Andrew Gerrand

http: fix redirect test for international users

R=r
CC=golang-dev
https://golang.org/cl/2197047
parent 855f0835
...@@ -7,6 +7,7 @@ package http ...@@ -7,6 +7,7 @@ package http
import ( import (
"bytes" "bytes"
"reflect" "reflect"
"regexp"
"strings" "strings"
"testing" "testing"
) )
...@@ -140,14 +141,15 @@ func TestMultipartReader(t *testing.T) { ...@@ -140,14 +141,15 @@ func TestMultipartReader(t *testing.T) {
func TestRedirect(t *testing.T) { func TestRedirect(t *testing.T) {
const ( const (
start = "http://google.com/" start = "http://google.com/"
end = "http://www.google.com/" endRe = "^http://www\\.google\\.[a-z.]+/$"
) )
var end = regexp.MustCompile(endRe)
r, url, err := Get(start) r, url, err := Get(start)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
r.Body.Close() r.Body.Close()
if r.StatusCode != 200 || url != end { if r.StatusCode != 200 || !end.MatchString(url) {
t.Fatalf("Get(%s) got status %d at %s, want 200 at %s", start, r.StatusCode, url, end) t.Fatalf("Get(%s) got status %d at %q, want 200 matching %q", start, r.StatusCode, url, endRe)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment