Skip to content

Commit 5c798a8

Browse files
committed
🐛 Switch back to httpcient, iwr fetching byte array
1 parent 84b78ba commit 5c798a8

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

ModuleFast.ps1

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ using namespace System.Reflection
77
# This is the bootstrap script for Modules
88
[CmdletBinding(PositionalBinding = $false)]
99
param (
10-
#Specify a specific release to use, otherwise 'latest' is used
11-
[string]$Release = 'latest',
12-
#Specify the user
13-
[string]$User = 'JustinGrote',
14-
#Specify the repo
15-
[string]$Repo = 'ModuleFast',
16-
#Specify the module file
17-
[string]$ModuleFile = 'ModuleFast.psm1',
18-
#Entrypoint to be used if additional args are specified
19-
[string]$EntryPoint = 'Install-ModuleFast',
20-
#Specify the module name
21-
[string]$ModuleName = 'ModuleFast',
22-
#Path of the module to bootstrap. You normally won't change this but you can override it if you want
23-
[string]$Uri = $(
24-
$base = "https://github.com/$User/$Repo/releases/{0}/$ModuleFile";
25-
$version = $Release -eq 'latest' ? 'latest/download' : "download/$Release";
26-
$base -f $version
27-
),
28-
#All additional arguments passed to this script will be passed to Install-ModuleFast
29-
[Parameter(ValueFromRemainingArguments)]$installArgs,
30-
#Used for testing
10+
#Specify a specific release to use, otherwise 'latest' is used
11+
[string]$Release = 'latest',
12+
#Specify the user
13+
[string]$User = 'JustinGrote',
14+
#Specify the repo
15+
[string]$Repo = 'ModuleFast',
16+
#Specify the module file
17+
[string]$ModuleFile = 'ModuleFast.psm1',
18+
#Entrypoint to be used if additional args are specified
19+
[string]$EntryPoint = 'Install-ModuleFast',
20+
#Specify the module name
21+
[string]$ModuleName = 'ModuleFast',
22+
#Path of the module to bootstrap. You normally won't change this but you can override it if you want
23+
[string]$Uri = $(
24+
$base = "https://github.com/$User/$Repo/releases/{0}/$ModuleFile";
25+
$version = $Release -eq 'latest' ? 'latest/download' : "download/$Release";
26+
$base -f $version
27+
),
28+
#All additional arguments passed to this script will be passed to Install-ModuleFast
29+
[Parameter(ValueFromRemainingArguments)]$installArgs,
30+
#Used for testing
3131
[Parameter(DontShow)]
3232
[switch]$ImportNugetVersioning,
3333
#Used for testing
@@ -75,7 +75,7 @@ if ($UseMain) {
7575
Write-Debug "Fetching $ModuleName from $Uri"
7676
$ProgressPreference = 'SilentlyContinue'
7777
try {
78-
$response = (Invoke-WebRequest $uri).Content
78+
$response = [HttpClient]::new().GetStringAsync($Uri).GetAwaiter().GetResult()
7979
} catch {
8080
$PSItem.ErrorDetails = "Failed to fetch $ModuleName from $Uri`: $PSItem"
8181
$PSCmdlet.ThrowTerminatingError($PSItem)

0 commit comments

Comments
 (0)