8000 Invoke-RestMethod does not return response headers · Issue #9769 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Invoke-RestMethod does not return response headers  #9769

@jianyunt

Description

@jianyunt

Background

I am responding my client request with 401 and sending back respond header with WWW-Authenticate: basic realm="apps" by following https://tools.ietf.org/html/rfc7235#section-4.1.
I can test it using postman. But I cannot use invoke-RestMethod because it does not return anything while 401.

Steps to reproduce

Invoke-RestMethod -Method Get -uri http://www.bing.comcomcomc -ResponseHeadersVariable aa
$aa      # it's empty

Expected behavior

headers should be displayed even if server response with error code.

Actual behavior

headers are empty if server responses with 401.

Environment data

6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0