You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/05/19 23:26:27 UTC

[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #4694: More Topologies validation

rawlinp commented on a change in pull request #4694:
URL: https://github.com/apache/trafficcontrol/pull/4694#discussion_r427655628



##########
File path: traffic_ops/client/topology.go
##########
@@ -30,94 +30,118 @@ const (
 )
 
 // CreateTopology creates a topology and returns the response.
-func (to *Session) CreateTopology(top tc.Topology) (*tc.TopologyResponse, ReqInf, error) {
-	var remoteAddr net.Addr
+func (to *Session) CreateTopology(top tc.Topology) (*tc.TopologyResponse, ReqInf, error, int) {
+	var (
+		statusCode = http.StatusNotAcceptable
+		remoteAddr net.Addr
+	)
 	reqBody, err := json.Marshal(top)
 	reqInf := ReqInf{CacheHitStatus: CacheHitStatusMiss, RemoteAddr: remoteAddr}
 	if err != nil {
-		return nil, reqInf, err
+		return nil, reqInf, err, statusCode

Review comment:
       Based on the mailing list discussion it sounds like consensus has been built around adding the status code to the `ReqInf` struct and returning it that way, so we should start following that pattern for these methods. Then in a separate PR someone could retroactively add the status code to `ReqInf` for the rest of the TO Go client methods.




----------------------------------------------------------------
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:
users@infra.apache.org