REST API: Child Endpoint is used instead of returning 404
tiwood opened this issue · comments
André Bindewald commented
Describe the Issue
I'm creating the following endpoint: /foo/bar
I'm expecting to get a 404 Not found
response if I'll try to access /foo
but instead I'm getting the response from /foo/bar
To Reproduce
#// start the API
$endpoints = @()
$endpoints += New-UDEndpoint -Url "/foo/bar" -Method "Get" -Endpoint {
[PSCustomObject]@{
endpoint = "/foo/bar"
} | ConvertTo-Json
}
Start-UDRestApi `
-Name "debug" `
-Endpoint $endpoints `
-Port 80 `
-Force `
-Wait
#// invoke rest method
Invoke-RestMethod -Method Get -Uri "http://127.0.0.1/api/foo"
This will return:
{
"endpoint": "/foo/bar"
}
Expected behavior
I'm expecting 404 Not found
Version Information
- Operating System: macOS 10.15.4
- PowerShell Version: 7.0.0
- Universal Dashboard Version: 2.90
- UD Hosting Method: Powershell
Adam Driscoll commented
This has been resolved in PowerShell Universal 1.2.