Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Feature Request: create switch to persist HTTP method when following a redirect for Invoke-RestMethod or Invoke-WebRequest #14531

Copy link
Copy link
@codaamok

Description

@codaamok
Issue body actions

Summary of the new feature/enhancement

This request is for a parameter which persists the original HTTP method used in Invoke-RestMethod and Invoke-WebRequest upon redirect. Currently, when the client receives a redirect from the web server, the HTTP client used by said cmdlets reissues the HTTP call but persistently uses HTTP GET, regardless what method was originally used.

This is typical to how browsers operate, and it's also how cURL operates out of the box, too.

Here is an example:

Invoke-RestMethod -Uri "http://test.acook.io" -Method POST

The web server will redirect the request to https:// and process index.php which just prints out $_SERVER['REQUEST_METHOD'] (link)

Proposed technical implementation details (optional)

A parameter that instructions the cmdlets to persist the originally intended HTTP method through redirects would be useful in scenarios where the web server issues a 30x redirect of http:// to https://.

cURL offers this parameter idea, but for just POST methods, via --post301, --post302 and --post303.

Ideally, this request is to have a switch which persists all types of HTTP methods through redirects via said cmdlets.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.