Title: Feature Request: create switch to persist HTTP method when following a redirect for Invoke-RestMethod or Invoke-WebRequest · Issue #14531 · PowerShell/PowerShell · GitHub
Open Graph Title: Feature Request: create switch to persist HTTP method when following a redirect for Invoke-RestMethod or Invoke-WebRequest · Issue #14531 · PowerShell/PowerShell
X Title: Feature Request: create switch to persist HTTP method when following a redirect for Invoke-RestMethod or Invoke-WebRequest · Issue #14531 · PowerShell/PowerShell
Description: 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 ser...
Open Graph Description: 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 cli...
X Description: 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 cli...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/14531
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: create switch to persist HTTP method when following a redirect for Invoke-RestMethod or Invoke-WebRequest","articleBody":"## Summary of the new feature/enhancement\r\n\r\n\u003c!-- \r\nA clear and concise description of what the problem is that the new feature would solve.\r\nTry formulating it in user story style (if applicable):\r\n'As a user I want X so that Y.' with X being the being the action and Y being the value of the action.\r\n--\u003e\r\n\r\nThis 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.\r\n\r\nThis is typical to how browsers operate, and it's also how cURL operates out of the box, too. \r\n\r\nHere is an example:\r\n\r\n```powershell\r\nInvoke-RestMethod -Uri \"http://test.acook.io\" -Method POST\r\n```\r\nThe web server will redirect the request to `https://` and process `index.php` which just prints out `$_SERVER['REQUEST_METHOD']` ([link](https://www.php.net/manual/en/reserved.variables.server.php))\r\n\r\n## Proposed technical implementation details (optional)\r\n\r\n\u003c!-- \r\nA clear and concise description of what you want to happen.\r\nConsider providing an example PowerShell experience with expected result.\r\n--\u003e\r\n\r\nA 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://`.\r\n\r\n[cURL](https://curl.se/docs/manpage.html) offers this parameter idea, but for just POST methods, via `--post301`, `--post302` and `--post303`.\r\n\r\nIdeally, this request is to have a switch which persists all types of HTTP methods through redirects via said cmdlets.","author":{"url":"https://github.com/codaamok","@type":"Person","name":"codaamok"},"datePublished":"2021-01-02T21:56:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/14531/PowerShell/issues/14531"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:55afbe90-2f0e-ec37-e54c-2f7e9afd7b35 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A682:2ACA91:1146B8E:1754296:6A544F2A |
| html-safe-nonce | 18314510db952fa4f1775e057e3a849d7c7615febec332d9b3467947fdb99f61 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjgyOjJBQ0E5MToxMTQ2QjhFOjE3NTQyOTY6NkE1NDRGMkEiLCJ2aXNpdG9yX2lkIjoiNTAyMTM1OTQyMjc0NTg5MDYwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ddea6974e75139dcd8a254975b9fb3d7543a6b53a2141c32df2b17c69d26c399 |
| hovercard-subject-tag | issue:777531339 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/14531/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2c1dc7e6dfa7eda77c452366ab04188f8212ff0f9070bdd195f68b4360557d11/PowerShell/PowerShell/issues/14531 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2c1dc7e6dfa7eda77c452366ab04188f8212ff0f9070bdd195f68b4360557d11/PowerShell/PowerShell/issues/14531 |
| og:image:alt | 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 cli... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | codaamok |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width