Passing array of strings to endpoint via url - seems to be joining with a comma

Passing array of strings to endpoint via url - seems to be joining with a comma

avatar

Hello!

I'm wondering if someone can point me in the right direction.

Script consists of:

Param([string[]]$Text)

foreach($Item in @($Text)) {
    [pscustomobject]@{
        Text = $Item
    }
}


If I then use the following (after creating the endpoint):

https://PSU.server.address/EndpointName?Text=sometext&Text=somemoretext


it seems to be joining both strings into a single string, delimited by a comma:

[
  {
    "Text": "sometext,somemoretext"
  }
]


Is this known behaviour, or am I doing something wrong?

All Comments (1)

avatar

@lloydmitchell This seems like incorrect behavior. We should be able to materialize the array from that query string input. I'll open a bug to track this.

Adam Driscoll
PowerShell Expert and Developer at Devolutions