diff --git a/github/github.go b/github/github.go index 22e5b51..8a64455 100644 --- a/github/github.go +++ b/github/github.go @@ -23,6 +23,11 @@ import ( "github.com/google/go-querystring/query" ) +const ( + // StatusUnprocessableEntity is the status code returned when sending a request with invalid fields. + StatusUnprocessableEntity = 422 +) + const ( libraryVersion = "0.1" defaultBaseURL = "https://api.github.com/" diff --git a/github/orgs_teams_test.go b/github/orgs_teams_test.go index a921592..a1d80f0 100644 --- a/github/orgs_teams_test.go +++ b/github/orgs_teams_test.go @@ -384,7 +384,7 @@ func TestOrganizationsService_AddTeamRepo_noAccess(t *testing.T) { mux.HandleFunc("/teams/1/repos/o/r", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - w.WriteHeader(422) + w.WriteHeader(StatusUnprocessableEntity) }) _, err := client.Organizations.AddTeamRepo(1, "o", "r", nil)