@@ -111,10 +111,7 @@ func TestOrganizationsService_CreateCodeSecurityConfiguration(t *testing.T) {
111111
112112 mux .HandleFunc ("/orgs/o/code-security/configurations" , func (w http.ResponseWriter , r * http.Request ) {
113113 v := new (CodeSecurityConfiguration )
114- err := json .NewDecoder (r .Body ).Decode (v )
115- if err != nil {
116- t .Errorf ("Organizations.CreateCodeSecurityConfiguration request body decode failed: %v" , err )
117- }
114+ assertNilError (t , json .NewDecoder (r .Body ).Decode (v ))
118115
119116 if ! reflect .DeepEqual (v , input ) {
120117 t .Errorf ("Organizations.CreateCodeSecurityConfiguration request body = %+v, want %+v" , v , input )
@@ -244,10 +241,7 @@ func TestOrganizationsService_UpdateCodeSecurityConfiguration(t *testing.T) {
244241
245242 mux .HandleFunc ("/orgs/o/code-security/configurations/1" , func (w http.ResponseWriter , r * http.Request ) {
246243 v := new (CodeSecurityConfiguration )
247- err := json .NewDecoder (r .Body ).Decode (v )
248- if err != nil {
249- t .Errorf ("Organizations.UpdateCodeSecurityConfiguration request body decode failed: %v" , err )
250- }
244+ assertNilError (t , json .NewDecoder (r .Body ).Decode (v ))
251245
252246 if ! reflect .DeepEqual (v , input ) {
253247 t .Errorf ("Organizations.UpdateCodeSecurityConfiguration request body = %+v, want %+v" , v , input )
@@ -329,10 +323,7 @@ func TestOrganizationsService_AttachCodeSecurityConfigurationsToRepositories(t *
329323 SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"`
330324 }
331325 v := new (request )
332- err := json .NewDecoder (r .Body ).Decode (v )
333- if err != nil {
334- t .Errorf ("Organizations.AttachCodeSecurityConfigurationsToRepositories request body decode failed: %v" , err )
335- }
326+ assertNilError (t , json .NewDecoder (r .Body ).Decode (v ))
336327 if v .Scope != "selected" {
337328 t .Errorf ("Organizations.AttachCodeSecurityConfigurationsToRepositories request body scope = %s, want selected" , v .Scope )
338329 }
0 commit comments