Browse Source

don't use http.Error with empty response bodies

internally, http.Error uses fmt.Fprintln() which will append a newline
to what should be an empty response body.  In one of my previous tests,
this was causing spurious errors.  I've since rewritten that test, but
still best to avoid it here.
Will Norris 13 years ago
parent
commit
df13964583
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      github/orgs_test.go

+ 3
- 3
github/orgs_test.go View File

@ -189,12 +189,12 @@ func TestOrganizationsService_CheckMembership_notMember(t *testing.T) {
if r.Method != "GET" {
t.Errorf("Request method = %v, want %v", r.Method, "GET")
}
http.Error(w, "", http.StatusNotFound)
w.WriteHeader(http.StatusNotFound)
})
member, err := client.Organizations.CheckMembership("o", "u")
if err != nil {
t.Errorf("Organizations.CheckMembership returned error: %v", err)
t.Errorf("Organizations.CheckMembership returned error: %+v", err)
}
want := false
if member != want {
@ -254,7 +254,7 @@ func TestOrganizationsService_CheckPublicMembership_notMember(t *testing.T) {
if r.Method != "GET" {
t.Errorf("Request method = %v, want %v", r.Method, "GET")
}
http.Error(w, "", http.StatusNotFound)
w.WriteHeader(http.StatusNotFound)
})
member, err := client.Organizations.CheckPublicMembership("o", "u")


Loading…
Cancel
Save