From df139645839abb23832c2476d5891305d18fd200 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Tue, 28 May 2013 18:21:15 -0700 Subject: [PATCH] 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. --- github/orgs_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/orgs_test.go b/github/orgs_test.go index 4422788..42c9667 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -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")