PowerShell-Docs
PowerShell-Docs copied to clipboard
Remove Trailing Slash '/' From Uri of Example 11 of Invoke-WebRequest
Type of issue
Typo
Feedback
Change Uri of Example 11 of Invoke-WebRequest by removing trailing slash '/' as shown below:
From: "http://localhost/v1.40/images/json/" To: "http://localhost/v1.40/images/json"
PowerShell Version
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Ubuntu 25.10
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Example Fail PowerShell
Invoke-WebRequest -Uri "http://localhost/v1.50/images/json/" -UnixSocket "/var/run/docker.sock"
Invoke-WebRequest:
{
"message": "page not found"
}
Example Pass PowerShell
Invoke-WebRequest -Uri "http://localhost/v1.50/images/json" -UnixSocket "/var/run/docker.sock"
StatusCode : 200
StatusDescription : OK
Content : [{"Containers" _REDACTED_ }]
Trailing Slash Uri Also Fails via Linux BASH/CURL
> echo $SHELL; which curl
/bin/bash
/usr/bin/curl
> curl --unix-socket /var/run/docker.sock http://localhost/v1.50/images/json/
{"message":"page not found"}
Non Trailing Slash URI Also Passes via Linux BASH/CURL
> echo $SHELL; which curl
/bin/bash
/usr/bin/curl
> curl --unix-socket /var/run/docker.sock http://localhost/v1.50/images/json
[{"Containers":-1,"Created":1764726479,"Id":"sha256:0ea" _REDACTED_ }]
Additional
Above passes and failure also occur with Ubuntu 24.04.3 LTS, PowerShell 7.5.4, Docker API 1.47. Examples omitted for brevity.
Page URL
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.5&WT.mc_id=ps-gethelp
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.5/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
Author
@sdwheeler
Platform Id
701d0868-82a8-94f8-6d1f-465037bae1d2
Document Id
b2e7e015-35b9-897c-3581-ad982240c97c