diff --git a/v2/routes.go b/v2/routes.go index f0627fc..4b337f0 100644 --- a/v2/routes.go +++ b/v2/routes.go @@ -454,16 +454,16 @@ func (s *Server) getCurrentState(w http.ResponseWriter, r *http.Request) { return } + if !strings.HasPrefix(resourceAddress, "/") { + resourceAddress = fmt.Sprintf("/%s", resourceAddress) + } + eventSubscribers := s.subscriberAPI.GetClientIDAddressByResource(resourceAddress) if len(eventSubscribers) == 0 { respondWithStatusCode(w, http.StatusNotFound, fmt.Sprintf("subscription not found for %s", resourceAddress)) return } - if !strings.HasPrefix(resourceAddress, "/") { - resourceAddress = fmt.Sprintf("/%s", resourceAddress) - } - // this is placeholder not sending back to report out := channel.DataChan{ Address: resourceAddress, diff --git a/v2/server_test.go b/v2/server_test.go index c8bf01a..3bde7b7 100644 --- a/v2/server_test.go +++ b/v2/server_test.go @@ -52,8 +52,8 @@ var ( port = 8990 apHost = "localhost" apPath = "/api/ocloudNotifications/v2/" - resource = "test/test" - resourceNoneSubscribed = "test/nonesubscribed" + resource = "/test/test" + resourceNoneSubscribed = "/test/nonesubscribed" storePath = "." ObjSub pubsub.PubSub ObjPub pubsub.PubSub