mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1044 from unihorn/119
http: check err return from http.NewRequest
This commit is contained in:
commit
3d272c2686
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user