File tree 2 files changed +9
-21
lines changed
2 files changed +9
-21
lines changed Original file line number Diff line number Diff line change @@ -186,8 +186,7 @@ function Start-Htmx {
186
186
while ($httpListener.IsListening ) {
187
187
try {
188
188
# If the server has a lifespan, we will stop it after the lifespan has passed.
189
- if (
190
- $LifeSpan -is [timespan ] -and
189
+ if ($LifeSpan -is [timespan ] -and
191
190
$lifeSpan.TotalMilliseconds -and
192
191
[DateTime ]::Now -gt $ServerStartTime.Add ($LifeSpan )
193
192
) {
@@ -361,7 +360,7 @@ function Start-Htmx {
361
360
} else {
362
361
# If we are on Windows, we will use a random port between 4kb and 32kb.
363
362
if (-not $port ) { $port = $ (Get-Random - Min 4 kb - Max 32 kb )}
364
- " http://localhost :$port /"
363
+ " http://127.0.0.1 :$port /"
365
364
}
366
365
} else {
367
366
$ServerUrl
Original file line number Diff line number Diff line change @@ -12,24 +12,13 @@ describe HtmxPS {
12
12
}
13
13
14
14
context ' Start-Htmx and Stop-Htmx' {
15
- it " Will start and stop a small htmx server" {
16
- if (-not $env: GITHUB_WORKSPACE ) {
17
- $startedLocalJob = Start-Htmx - Htmx (
18
- htmx button " Click Me" hx- on:click= " alert('Thanks, I needed that!')"
19
- )
20
- Invoke-RestMethod - Uri $startedLocalJob.ServerUrl
21
- $startedLocalJob | Stop-Htmx
22
- $startedLocalJob | Remove-Job
23
- } elseif ($env: HOSTNAME ) {
24
- $startedLocalJob = Start-Htmx - Htmx (
25
- htmx button " Click Me" hx- on:click= " alert('Thanks, I needed that!')"
26
- ) - ServerUrl " http://$env: HOSTNAME :$ ( Get-Random - Min 4 kb - Max 32 kb ) "
27
- Invoke-RestMethod - Uri $startedLocalJob.ServerUrl
28
- $startedLocalJob | Stop-Htmx
29
- $startedLocalJob | Remove-Job
30
- } else {
31
- Write-Warning " This test cannot be run without a GitHub workflow that has a host name."
32
- }
15
+ it " Will start and stop a small htmx server" {
16
+ $startedLocalJob = Start-Htmx - Htmx (
17
+ htmx button " Click Me" hx- on:click= " alert('Thanks, I needed that!')"
18
+ )
19
+ Invoke-RestMethod - Uri $startedLocalJob.ServerUrl
20
+ $startedLocalJob | Stop-Htmx
21
+ $startedLocalJob | Remove-Job
33
22
}
34
23
}
35
24
}
You can’t perform that action at this time.
0 commit comments