RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
214 stars 47 forks source link

Adds ability to use basic authentication #116

Closed tobvil closed 4 years ago

tobvil commented 5 years ago

This will allow users of the module to connect to private nuget repositories which uses basic authentication

RamblingCookieMonster commented 5 years ago

Hiyo!

For these, can you do something like:

$params = @{
    Uri = $Uri
}
if($PSBoundParameters.ContainsKey('Credential')){
    $Params.add('Credential', $Credential)
}
Invoke-RestMethod @params

Otherwise, I think it might not be happy if folks don't specify a credential?

Thanks!

tobvil commented 5 years ago

If $Credential is not specified it becomes $Null and will be ignored by Invoke-RestMethod.

But i like your solution better, i've added the changes :)