diff --git a/svc-api/handle/handlers.go b/svc-api/handle/handlers.go index 34a7b2932..b8456e8a9 100755 --- a/svc-api/handle/handlers.go +++ b/svc-api/handle/handlers.go @@ -1241,6 +1241,12 @@ func UpdateServiceMethodNotAllowed(ctx iris.Context) { fillMethodNotAllowedErrorResponse(ctx) return } +func MethodNotAllowed(ctx iris.Context) { + defer ctx.Next() + ctx.ResponseWriter().Header().Set("Allow", "GET") + fillMethodNotAllowedErrorResponse(ctx) + return +} // ChassisMethodNotAllowed holds builds reponse for the unallowed http operation on Chassis URLs and returns 405 error. func ChassisMethodNotAllowed(ctx iris.Context) { diff --git a/svc-api/router/router.go b/svc-api/router/router.go index 0d662dbc5..8a4e7885e 100755 --- a/svc-api/router/router.go +++ b/svc-api/router/router.go @@ -195,7 +195,7 @@ func Router() *iris.Application { serviceRoot := handle.InitServiceRoot() router := iris.New() - + router.OnErrorCode(iris.StatusNotFound, handle.SystemsMethodInvalidURI) var reqBody map[string]interface{} // Parses the URL and performs URL decoding for path // Getting the request body copy @@ -680,6 +680,14 @@ func Router() *iris.Application { telemetryService.Get("/MetricReports/{id}", telemetry.GetMetricReport) telemetryService.Get("/Triggers/{id}", telemetry.GetTrigger) telemetryService.Patch("/Triggers/{id}", telemetry.UpdateTrigger) + telemetryService.Any("/MetricDefinitions", handle.MethodNotAllowed) + telemetryService.Any("/MetricReportDefinitions", handle.MethodNotAllowed) + telemetryService.Any("/MetricReports", handle.MethodNotAllowed) + telemetryService.Any("/Triggers", handle.MethodNotAllowed) + telemetryService.Any("/MetricDefinitions/{id}", handle.MethodNotAllowed) + telemetryService.Any("/MetricReportDefinitions/{id}", handle.MethodNotAllowed) + telemetryService.Any("/MetricReports/{id}", handle.MethodNotAllowed) + telemetryService.Any("/Triggers/{id}", handle.MethodNotAllowed) licenseService := v1.Party("/LicenseService", middleware.SessionDelMiddleware) licenseService.SetRegisterRule(iris.RouteSkip) @@ -715,4 +723,4 @@ func Router() *iris.Application { compositionService.Any("/FreePool", handle.CompositionServiceMethodNotAllowed) compositionService.Any("/ActivePool", handle.CompositionServiceMethodNotAllowed) return router -} +} \ No newline at end of file