Your code is currently fetching the baseUrl (Get-BaseHost) and the headers (Get-Header) within the process {} block.
As the data returned by these two functions stays the same within the scope of the pipe execution.
I have moved them into the begin {} block, as the process {} block gets executed for every objects passed in though the pipe.
Let me know if you are interested in a PR for this.
Your code is currently fetching the baseUrl (
Get-BaseHost
) and the headers (Get-Header
) within theprocess {}
block. As the data returned by these two functions stays the same within the scope of the pipe execution.I have moved them into the
begin {}
block, as theprocess {}
block gets executed for every objects passed in though the pipe.Let me know if you are interested in a PR for this.