philips-software / powershell-cf-api

PowerShell module can deploy and teardown CloudFoundry spaces and services via a json definition file
MIT License
5 stars 6 forks source link

optimize common data when using the pipeline #12

Open lipkau opened 4 years ago

lipkau commented 4 years ago

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.

marklindell commented 4 years ago

Agreed. A PR is welcomed.