Skip to content

Commit

Permalink
lwcapi: list streams if path ends with / (#1423)
Browse files Browse the repository at this point in the history
Update the matching logic to list for the end of the path
or a single slash. Before it would try to use an empty string
as the id which can be confusing.
  • Loading branch information
brharrington authored Mar 30, 2022
1 parent 0afe6fe commit 50132b2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class StreamsApi @Inject() (sm: StreamSubscriptionManager) extends WebApi {

def routes: Route = {
endpointPathPrefix("api" / "v1" / "streams") {
pathEndOrSingleSlash {
complete(Json.encode(sm.streamSummaries.map(_.metadata)))
} ~
path(Remaining) { streamId =>
sm.streamSummary(streamId) match {
case Some(summary) => complete(Json.encode(summary))
case None => complete(notFound(streamId))
}
} ~
pathEnd {
complete(Json.encode(sm.streamSummaries.map(_.metadata)))
}
}
}
Expand Down

0 comments on commit 50132b2

Please sign in to comment.