rawlinp commented on a change in pull request #4011: Implement GET /api/1.1/roles handler URL: https://github.com/apache/trafficcontrol/pull/4011#discussion_r337721593
########## File path: traffic_ops/traffic_ops_golang/role/roles.go ########## @@ -159,16 +159,32 @@ func (role *TORole) deleteRoleCapabilityAssociations(tx *sqlx.Tx) (error, error, } func (role *TORole) Read() ([]interface{}, error, error, int) { + version := role.APIInfo().Version + if version == nil { + return nil, nil, errors.New("TORole.Read called with nil API version"), http.StatusInternalServerError + } + if version.Major != 1 || version.Minor < 1 { + return nil, nil, fmt.Errorf("TORole.Read called with invalid API version: %d.%d", version.Major, version.Minor), http.StatusInternalServerError + } Review comment: Yeah, I was on the fence about whether or not to include this check. This condition would only be true if there was a bug introduced into the routing middleware, so really it's just an extra safety check in case that ever happens. I can remove it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services