Skip to content

Invoke-WebRequest / Invoke-RestMethod -Verbose shows requested rather than actual version #19615

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Note:

  • Perhaps the behavior is by design: show what version was requested.
  • However, at least the actual HTTP version used is also worth knowing.
 ((Invoke-WebRequest https://example.org -Verbose -HttpVersion 3).RawContent -split '\r?\n', 2)[0]

Expected behavior

VERBOSE: HTTP/2.0 GET with 0-byte payload
VERBOSE: received response of content type text/html of unknown size
HTTP/2.0 200 OK

Actual behavior

VERBOSE: HTTP/3.0 GET with 0-byte payload
VERBOSE: received response of content type text/html of unknown size
HTTP/2.0 200 OK

That is, even though the actual HTTP version is 2.0, the -Verbose output shows the requested version.

Error details

No response

Environment data

PowerShell 7.4.0-preview.3

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions