From 7cdad2d9ca3b58f9ddaec31fbbdae9ef365eda48 Mon Sep 17 00:00:00 2001 From: hellerve Date: Tue, 6 Dec 2016 14:44:18 +0100 Subject: [PATCH] added proto counts to validated methods --- endpoints/routes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/endpoints/routes.go b/endpoints/routes.go index 3d1fcf2..f13becd 100644 --- a/endpoints/routes.go +++ b/endpoints/routes.go @@ -20,7 +20,11 @@ func TableRoutes(ps httprouter.Params) (bird.Parsed, bool) { } func ProtoCount(ps httprouter.Params) (bird.Parsed, bool) { - return bird.RoutesProtoCount(ps.ByName("protocol")) + protocol, err := ValidateProtocolParam(ps.ByName("protocol")) + if err != nil { + return bird.Parsed{"error": fmt.Sprintf("%s", err)}, false + } + return bird.RoutesProtoCount(protocol) } func TableCount(ps httprouter.Params) (bird.Parsed, bool) {