From 413f58597619d717ea0717a1c58765faa673179c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 9 Nov 2017 16:08:18 +0000 Subject: [PATCH] loader: don't hard-code mainRouter in loadApps This was causing a new test to fail, as it could not properly load APIs on a custom muxer. This was simply never spotted as loadApps is always passed mainRouter in the production code. --- api_definition_test.go | 1 - api_loader.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/api_definition_test.go b/api_definition_test.go index e6be8ac56ef..bcbad47393a 100644 --- a/api_definition_test.go +++ b/api_definition_test.go @@ -106,7 +106,6 @@ func createDefinitionFromString(defStr string) *APISpec { loader := APIDefinitionLoader{} def := loader.ParseDefinition(strings.NewReader(defStr)) spec := loader.MakeSpec(def) - spec.APIDefinition = def return spec } diff --git a/api_loader.go b/api_loader.go index c10ac2bdea9..a9411a8b480 100644 --- a/api_loader.go +++ b/api_loader.go @@ -552,7 +552,7 @@ func loadApps(specs []*APISpec, muxer *mux.Router) { "api_name": spec.Name, "domain": spec.Domain, }).Info("Custom Domain set.") - subrouter = mainRouter.Host(spec.Domain).Subrouter() + subrouter = subrouter.Host(spec.Domain).Subrouter() } chainObj := processSpec(spec, apisByListen, redisStore, redisOrgStore, healthStore, rpcAuthStore, rpcOrgStore, subrouter) chainObj.Index = i