Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resourceAddress when search for subscription #75

Merged
merged 1 commit into from
Aug 2, 2024
Merged
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
8 changes: 4 additions & 4 deletions v2/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions v2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down