Merge pull request #1044 from unihorn/119

http: check err return from http.NewRequest
This commit is contained in:
Xiang Li 2014-09-09 20:48:56 -07:00
commit 3d272c2686

View File

@ -363,7 +363,10 @@ func TestV2MachinesEndpoint(t *testing.T) {
defer s.Close()
for _, tt := range tests {
req, _ := http.NewRequest(tt.method, s.URL+machinesPrefix, nil)
req, err := http.NewRequest(tt.method, s.URL+machinesPrefix, nil)
if err != nil {
t.Fatal(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
t.Fatal(err)
@ -381,7 +384,10 @@ func TestServeMachines(t *testing.T) {
h := Handler{Peers: peers}
writer := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "", nil)
req, err := http.NewRequest("GET", "", nil)
if err != nil {
t.Fatal(err)
}
h.serveMachines(writer, req)
w := "http://localhost:8080, http://localhost:8081, http://localhost:8082"
if g := writer.Body.String(); g != w {