mhoppa commented on a change in pull request #4378: updated API to version 2.x
URL: https://github.com/apache/trafficcontrol/pull/4378#discussion_r378314059
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/routing/routes.go
 ##########
 @@ -722,6 +1118,13 @@ func notImplementedHandler(w http.ResponseWriter, r 
*http.Request) {
        w.Write([]byte(http.StatusText(code)))
 }
 
+// notFoundHandler returns a 404 Not Found to the client.  This should be the 
new rootHandler for API version 2.x in order to prevent falling back to Perl.
+func notFoundHandler(w http.ResponseWriter, r *http.Request) {
+       code := http.StatusNotFound
+       w.WriteHeader(code)
 
 Review comment:
   can we write an alert like we do in perl when the route is not found ->
   
   ```
   {
       "alerts": [
           {
               "level": "error",
               "text": "Resource not found."
           }
       ]
   }
   ```
   
   currently this implementation returns ```Not Found``` in the response

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

Reply via email to