New-PSUEndpoint routing parameter with default value

I’ve created a PSUEndpoint (with a routing parameter):

New-PSUEndpoint -Url “/test/:param1” -Endpoint {
param(
$param1=‘test’
)
New-PSUApiResponse -StatusCode 200 -Body “Param1: ‘$param1’”
}

If I call this endpoint with Invoke-Restmethod -Uri 'http://psu.domain.local/test/parameter47 it works perfect returning “Param1: ‘parameter47’”.

If I call this endpoint with Invoke-Restmethod -Uri ‘http://psu.domain.local/test’ it doesn’t work (returning 404 not found).

Is it possible to default a routing parameter, so that I can call it without the routing parameter? The best I’ve found was to add a second endpoint (without the routing parameter) to call the endpoint with the routing parameter with the default value. But this adds some extra effort, like returning the result of the endpoint with the routing parameter and “doubling” the error handling.

Thanks
Roland

Just make a
New-PSUEndpoint -Url “/test”
that call your New-PSUEndpoint -Url “/test/:param1”
with default value?

Thanks, this is my current workaround, but it adds some extra work. I have to get the response of /test/:param1 and return it to the caller of /test. I have to “double” error handling (/test/:param1) returns different Status Codes - depending on the “error” occured.

And (as an author of the endpoint) it could be quite simple to avoid this, if the param Block in my post would work.