PSScriptTools icon indicating copy to clipboard operation
PSScriptTools copied to clipboard

Invoke-WebRequest using Net.WebRequest instead of Net.Http.HttpClient

Open God-damnit-all opened this issue 4 years ago • 0 comments

Beginning with PowerShell 6, PowerShell began to use Net.Http.HttpClient for Invoke-WebRequest instead of Net.WebRequest. Unfortunately, it would seem that this was a pretty massive downgrade. Even just a basic Invoke-WebRequest "https://postman-echo.com/get?i=test" is twice as slow as it is on PS5.

Aside from being useful for later PowerShell versions, it could have some QoL like making Accept-Encoding include deflate and gzip by default and checking the header before downloading to see if the incoming data is going to be binary or text.

God-damnit-all avatar Jan 19 '22 05:01 God-damnit-all