Private/ConvertTo-GetParameter.ps1
function ConvertTo-GetParameter { <# .SYNOPSIS Generate the GET parameter string for an URL from a hashtable #> [CmdletBinding()] param ( [Parameter( Position = 0, Mandatory = $true, ValueFromPipeline = $true )] [hashtable]$InputObject ) BEGIN { [string]$parameters = "?" } PROCESS { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Making HTTP get parameter string out of a hashtable" foreach ($key in $InputObject.Keys) { $parameters += "$key=$($InputObject[$key])&" } } END { $parameters -replace ".$" } } |