zrhoffman commented on a change in pull request #5094:
URL: https://github.com/apache/trafficcontrol/pull/5094#discussion_r499910607



##########
File path: traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
##########
@@ -266,6 +266,14 @@ func createV30(w http.ResponseWriter, r *http.Request, inf 
*api.APIInfo, ds tc.D
                deepCachingType = ds.DeepCachingType.String() // necessary, 
because DeepCachingType's default needs to insert the string, not "", and Query 
doesn't call .String().
        }
 
+       if ds.Topology != nil {
+               if ok, err := dbhelpers.TopologyExistsString(tx, *ds.Topology); 
err != nil {
+                       return nil, http.StatusInternalServerError, nil, 
fmt.Errorf("checking topology existence: %v", err)
+               } else if !ok {
+                       return nil, http.StatusConflict, fmt.Errorf("no such 
Topology '%s'", *ds.Topology), nil

Review comment:
       Where is the conflict? [From RFC 
2616](https://tools.ietf.org/html/rfc2616#section-10.4.10):
   
   > The request could not be completed due to a conflict with the current 
state of the resource.
   
   Also:
   
   > Conflicts are most likely to occur in response to a PUT request. For 
example, if versioning were being used and the entity being PUT included 
changes to a resource which conflict with those made by an earlier 
(third-party) request, the server might use the 409 response to indicate that 
it can't complete the request. In this case, the response entity would likely 
contain a list of the differences between the two versions in a format defined 
by the response Content-Type.
   
   ---
   
   > In this case the request payload would be considered acceptable if the 
state of the server were to change but nothing about the request itself changes 
- _or_ if the request changes to be acceptable given the server's state.
   
   We have no reason to believe that any such topology ever did exist in the 
past, so a case in which the server happens to create a topology that is named 
just the right thing for our request to succeed is improbable and cannot be 
chalked up to state.




----------------------------------------------------------------
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]


Reply via email to