Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write-PodeTextResponse silently fails if the -Value parameter is not specified #974

Closed
pcgeek86 opened this issue Jun 1, 2022 · 1 comment · Fixed by #983
Closed

Write-PodeTextResponse silently fails if the -Value parameter is not specified #974

pcgeek86 opened this issue Jun 1, 2022 · 1 comment · Fixed by #983
Assignees
Labels
Milestone

Comments

@pcgeek86
Copy link
Contributor

pcgeek86 commented Jun 1, 2022

Describe the Bug

Write-PodeTextResponse silently fails if the -Value parameter is not specified.
Pode throws an HTTP error 500.

Steps To Reproduce

Start-PodeServer -ScriptBlock {
 Add-PodeEndpoint -Address 0.0.0.0 -Protocol Http -Port 15002
 New-PodeLoggingMethod -Terminal | Enable-PodeRequestLogging
 Add-PodeRoute -Method Get -Path / -ScriptBlock { Write-PodeTextResponse 'Hello Pode' }
}
Invoke-WebRequest -Uri http://localhost:15002/

Expected Behavior

If possible, Pode should reject the invalid route configuration, due to the missing parameter.
Errors from the runspace handling the HTTP request should be surfaced to the parent runspace.

Platform

  • OS: Windows 11
  • Browser: n/a
  • Versions:
    • Pode: 2.5.2
    • PowerShell: 7.2.1
@Badgerati
Copy link
Owner

Hi @pcgeek86,

If you add New-PodeLoggingMethod -Terminal | Enable-PodeErrorLogging the error is shown on the terminal :)

Hooowever, it does highlight something that could be added though: if I add the Position=0 property to the -Value parameter then Write-PodeTextResponse 'Hello Pode' works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants