Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions svc-api/handle/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 10 additions & 2 deletions svc-api/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -715,4 +723,4 @@ func Router() *iris.Application {
compositionService.Any("/FreePool", handle.CompositionServiceMethodNotAllowed)
compositionService.Any("/ActivePool", handle.CompositionServiceMethodNotAllowed)
return router
}
}