rob05c commented on a change in pull request #3023: WIP Supported routes fetch
URL: https://github.com/apache/trafficcontrol/pull/3023#discussion_r233152127
##########
File path: traffic_ops/traffic_ops_golang/routes.go
##########
@@ -424,6 +424,17 @@ func Routes(d ServerData) ([]Route, []RawRoute,
http.Handler, error) {
{http.MethodGet, `tools/write_crconfig/{cdn}/?$`,
crconfig.SnapshotOldGUIHandler, auth.PrivLevelOperations, Authenticated, nil},
// DEPRECATED - use GET /api/1.2/cdns/{cdn}/snapshot
{http.MethodGet, `CRConfig-Snapshots/{cdn}/CRConfig.json?$`,
crconfig.SnapshotOldGetHandler, auth.PrivLevelReadOnly, Authenticated, nil},
+
+ // The '/api' endpoint, that tells clients what routes are
available under /api/1.x
+ {http.MethodGet, `api/?$`, api.AvailableRoutesHandler, 0,
false, nil},
+ {http.MethodHead, `api/?$`,
api.AvailableRoutesBadMethodHandler, 0, false, nil},
Review comment:
This shouldn't be necessary. You're right, 405 is a better code when this
happens. But it would terribly clutter up the routes file, if we did it like
this for every route.
We should instead change the router itself, to return a 405 when a route
exists but not for the requested method. That should probably be its own PR, as
well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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