File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,15 +15,13 @@ function Install-NugetPackage {
1515 $packageLowerName = $Name.ToLower ()
1616 $Api = $Api.TrimEnd (' /' )
1717 # Get API endpoint URLs
18- $index = Invoke-WebRequest " $Api /index.json" - ErrorAction Stop
19- $indexObject = $index.Content | ConvertFrom-Json
18+ $index = Invoke-RestMethod " $Api /index.json" - ErrorAction Stop
2019
2120 # search for package
22- $searchUrl = $indexObject .resources | Where-Object { $_ .' @type' -eq ' SearchQueryService' } | Select-Object - First 1
21+ $searchUrl = $index .resources | Where-Object { $_ .' @type' -eq ' SearchQueryService' } | Select-Object - First 1
2322 $query = " ?q=PackageId:{0}&prerelease={1}" -f $Name , (-Not $SkipPreRelease ).ToString().ToLower()
24- $packageInfoResponse = Invoke-WebRequest - Uri " $ ( $searchUrl .' @id' ) $query " - ErrorAction Stop
25- $packageInfoObject = $packageInfoResponse.Content | ConvertFrom-Json
26- $packageInfo = $packageInfoObject.data | Select-Object - First 1
23+ $packageInfoResponse = Invoke-RestMethod - Uri " $ ( $searchUrl .' @id' ) $query " - ErrorAction Stop
24+ $packageInfo = $packageInfoResponse.data | Select-Object - First 1
2725 if (-Not $packageInfo ) {
2826 Stop-PSFFunction - Message " Package $Name was not found"
2927 }
@@ -84,7 +82,7 @@ function Install-NugetPackage {
8482 }
8583 $path = Join-PSFPath $scopePath " $packageName .$selectedVersion "
8684 $packagePath = Join-PSFPath $path $fileName
87- if ($PSCmdlet.ShouldProcess ([ string ] $fileName )) {
85+ if ($PSCmdlet.ShouldProcess ($fileName , " Download package " )) {
8886 if (Test-Path $path ) {
8987 if ($Force ) {
9088 Remove-Item $path - Recurse - Force
You can’t perform that action at this time.
0 commit comments