ocket8888 commented on a change in pull request #4011: Implement GET
/api/1.1/roles handler
URL: https://github.com/apache/trafficcontrol/pull/4011#discussion_r337709162
##########
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:
I don't think you need to do this, because that check ought to be caught by
[some
middleware](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/routing/wrappers.go#L281-L287).
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services