ocket8888 commented on a change in pull request #5003:
URL: https://github.com/apache/trafficcontrol/pull/5003#discussion_r483106834



##########
File path: traffic_ops/v3-client/server.go
##########
@@ -117,6 +117,9 @@ func (to *Session) CreateServer(server tc.ServerNullable) 
(tc.Alerts, ReqInf, er
        resp, remoteAddr, err := to.request(http.MethodPost, API_SERVERS, 
reqBody, nil)
        reqInf.RemoteAddr = remoteAddr
        if err != nil {
+               if strings.Contains(err.Error(), "400 Bad Request[400]") {
+                       reqInf.StatusCode = 400
+               }

Review comment:
       We should just set `reqInf.StatusCode` to `resp.StatusCode` so that it's 
directly captured whatever value it happens to have, and doesn't rely on string 
pattern matching.




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