New-udendpoint with param, filter output multiply times

hey all,
I have made an scheduled endpoint that dump the result to $cache:opteams
Then I have created a new endpoint to be able to filter on this:

New-UDEndpoint -Url “/toolkits/:team” -Method “GET” -Endpoint {

Cache:OpTeams.Where({_.opTeam -eq $team})
for some reason this will generate a reply X Number of time the condition are true.
and it will return the full dataset.

Whats up with that?
the opteams are a object from invoke-sqlcmd (dbatools)

Can you do me a favor and try to store your value in a variable then filter that?

$Temp = Cache:OpTeams
$Temp.Where({_.opTeam -eq $team})

I’ve seen the $Session and $Cache scopes do some weird stuff sometimes.

Still no luck.

the funny thing is that this work flawless in a new-udtable, with filter and all.

why dont it work in the new-udendpoint?

note: I am running with pwsh 6.1, on windows 10 1809, and using chrome to access the endpoint.

Something is wrong with udendpoint. :slight_smile: