API call with persistent environment will only return first body received

Product: PowerShell Universal
Version: 5.0.12

I’m still extremely new to PowerShell Universal and I’m trying to get a handle on things still but the below seems like it should be pretty straight forward but isn’t working as expected. A simple Endpoint is created with a variable URL in a persistent environment.

New-PSUEndpoint -Url "/test/:test" -Method @('GET') -Endpoint {
return $test
} -Environment "Exchange"

Executing the following Invoke-RestMethod returns ‘testvalue1’ as expected

Invoke-RestMethod -uri 'https://localhost:5000/test/testvalue1' -method GET

Running the same command again with a value of testvalue2 returns ‘testvalue1’ again however. Nothing entered as a value for ‘test’ variable is returned. Its always the first value that was submitted until the environment is restarted.

Am I misunderstaing or just doing something wrong?

I’ve tried using parameters, submitting as Body isntead of Variable URL and nothing I seem to do will ever overwrite the first submitted value to the endpoint.

I was really hoping to hear if this was something that I was just doing wrong or if this was a legit issue that needs to be addressed.
I’m still doing “Hello World” style tests just to get familiar and make sure my understanding of the pieces and parts are correct and I’m hesitant to move on to more complicated tasks until I’m sure that the basics are working properly.
Does anyone have any feedback they can give me on this? Should this work or am I just doing it wrong?

I can reproduce this. This shouldn’t be happening. I don’t see it without the persistent runspace setting.

I’m having the same problem with 5.0.15. @adam any chances you can take a look at this ?

This has been fixed for .16.

when do you plan to release it ? :slight_smile:

November 18 - 5.0.16 Milestone · GitHub

I have the same issue with

5.0.14 / 13 / 12 / 11 / 10 , keep trying :smiley:

It has been an issue in all v5 releases, that I’m aware of. It’s definitely fixed in .16 . We have automated tests that cover this now.

1 Like

ah ok, so I can stop testing releases :smiley:

I’ll wait then, if there is no other choices

Thank you @adam for verifying, fixing this in a future release and validating that I’m not crazy (or at least not in regard to this issue :upside_down_face:)

I’m looking forward to digging into PSU more and finding way to help my organization with it.

Have a great day!