ironmansoftware / universal-dashboard

Build beautiful websites with PowerShell.

Home Page:https://universaldashboard.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

REST API: Child Endpoint is used instead of returning 404

tiwood opened this issue · comments

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

This has been resolved in PowerShell Universal 1.2.