Badgerati / Pode

Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
https://badgerati.github.io/Pode
MIT License
830 stars 92 forks source link

Fixes the Write-Pode(*)Response functions so the Value parameter appropriately handles when an array is passed using piping #1319

Closed mdaneri closed 3 months ago

mdaneri commented 3 months ago

Address the #1272 bug (Write-PodeHtmlResponse returns the wrong result when an array of strings is piped.) The same issue is present with the following functions:

Description of the Change

Added support for array values passed using piping

Related Issue

Issue @1272

Examples

Add-PodeRoute -Path '/processesPipedNotWorking'  -Method Get -ScriptBlock {
        Get-Process | .{ process { if ($_.WS -gt 100mb) { $_ } } } |
            Select-Object Name, @{e = { [int]($_.WS / 1mb) }; n = 'WS' } |
            Sort-Object WS -Descending | Write-PodeHtmlResponse  -StatusCode 200
    }