Title: Invoke-WebRequest removes the Content-Type header from WebResponseObject's · Issue #4467 · PowerShell/PowerShell · GitHub
Open Graph Title: Invoke-WebRequest removes the Content-Type header from WebResponseObject's · Issue #4467 · PowerShell/PowerShell
X Title: Invoke-WebRequest removes the Content-Type header from WebResponseObject's · Issue #4467 · PowerShell/PowerShell
Description: The Content-Type header appears to be missing everywhere except $response.BaseResponse.Content.Headers.ContentType. it is even being removed from $response.RawContent . it happens regardless of using -UseBasicParsing or not, regardless o...
Open Graph Description: The Content-Type header appears to be missing everywhere except $response.BaseResponse.Content.Headers.ContentType. it is even being removed from $response.RawContent . it happens regardless of usi...
X Description: The Content-Type header appears to be missing everywhere except $response.BaseResponse.Content.Headers.ContentType. it is even being removed from $response.RawContent . it happens regardless of usi...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/4467
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invoke-WebRequest removes the Content-Type header from WebResponseObject's","articleBody":"\u003c!--\r\n\r\nIf it is a bug report:\r\n- make sure you are able to repro it on the latest released version. \r\nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\r\n- Search the existing issues.\r\n- Refer to the [FAQ](../docs/FAQ.md).\r\n- Refer to the [known issues](../docs/KNOWNISSUES.md).\r\n- Fill out the following repro template\r\n\r\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\r\n--\u003e\r\nThe `Content-Type` header appears to be missing everywhere except `$response.BaseResponse.Content.Headers.ContentType`. it is even being removed from `$response.RawContent` . it happens regardless of using `-UseBasicParsing` or not, regardless of `-method` and regardless of `-UserAgent`.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\nDescribe 'Invoke-WebRequest' {\r\n Context 'Response: Content-Type Header' {\r\n $Uri = 'http://httpbin.org/headers'\r\n $response = Invoke-WebRequest -Uri $Uri\r\n It \"Has BaseResponse.Content.Headers.ContentType\" {\r\n $response.BaseResponse.Content.Headers.ContentType | \r\n Should Not BeNullOrEmpty\r\n }\r\n It \"Has Headers.'Content-Type'\" {\r\n $response.Headers.ContainsKey('Content-Type') | Should Be $True\r\n $response.Headers.'Content-Type' | Should Not BeNullOrEmpty\r\n }\r\n It \"Has BaseResponse.Headers.'Content-Type'\" {\r\n $response.BaseResponse.Headers.Keys -contains 'Content-Type' | Should Be $True\r\n $response.BaseResponse.Headers.Get('Content-Type') | Should Not BeNullOrEmpty\r\n }\r\n It \"Has BaseResponse.ContentType\" {\r\n $response.BaseResponse.ContentType | Should Not BeNullOrEmpty\r\n }\r\n It \"Has Content-Type in the RawContent\" {\r\n $response.RawContent -match 'Content-Type' | Should Be $True\r\n }\r\n }\r\n}\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nDescribing Invoke-WebRequest\r\n\r\n Context Response: Content-Type Header\r\n [+] Has BaseResponse.Content.Headers.ContentType.MediaType 12.62s\r\n [+] Has Headers.'Content-Type' 11.36s\r\n [+] Has BaseResponse.Headers.'Content-Type' 28ms\r\n [+] Has BaseResponse.ContentType 10ms\r\n [+] Has Content-Type in the RawContent 18ms\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\nDescribing Invoke-WebRequest\r\n Context Response: Content-Type Header\r\n [+] Has BaseResponse.Content.Headers.ContentType 13.59s\r\n [-] Has Headers.'Content-Type' 42ms\r\n Expected: {True}\r\n But was: {False}\r\n at line: 10 in\r\n 10: $response.Headers.ContainsKey('Content-Type') | Should Be $True\r\n [-] Has BaseResponse.Headers.'Content-Type' 23ms\r\n Expected: {True}\r\n But was: {False}\r\n at line: 14 in\r\n 14: $response.BaseResponse.Headers.Keys -contains 'Content-Type' | Should Be $True\r\n [-] Has BaseResponse.ContentType 24ms\r\n Expected: value to not be empty\r\n at line: 18 in\r\n 18: $response.BaseResponse.ContentType | Should Not BeNullOrEmpty\r\n [-] Has Content-Type in the RawContent 28ms\r\n Expected: {True}\r\n But was: {False}\r\n at line: 21 in\r\n 21: $response.RawContent -match 'Content-Type' | Should Be $True\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable --\u003e\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 6.0.0-beta\r\nPSEdition Core\r\nGitCommitId v6.0.0-beta.4\r\nOS Microsoft Windows 10.0.15063\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/markekraus","@type":"Person","name":"markekraus"},"datePublished":"2017-08-02T22:33:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/4467/PowerShell/issues/4467"}
| 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:3720c1a0-3ca1-a1f3-8478-fcbc6a15db55 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB64:336A5A:C4A579:11EBF9C:6A57647E |
| html-safe-nonce | 7f3ea0ecae547e88e2e3273f3a28c853f836bbf9e320968b3c64ea16f39e8c2a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjY0OjMzNkE1QTpDNEE1Nzk6MTFFQkY5Qzo2QTU3NjQ3RSIsInZpc2l0b3JfaWQiOiIyMjM3OTE2MTkxOTUxMTE5NDg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9e429ebb56714f7f2f02e0962f2b446f5d971310fb89cca66c205e66ce7aab36 |
| hovercard-subject-tag | issue:247542261 |
| 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/4467/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3e6cda3ed39e88428b76e0ac5d3035c9376b0db8a36907f1a76e1054a1dace7e/PowerShell/PowerShell/issues/4467 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3e6cda3ed39e88428b76e0ac5d3035c9376b0db8a36907f1a76e1054a1dace7e/PowerShell/PowerShell/issues/4467 |
| og:image:alt | The Content-Type header appears to be missing everywhere except $response.BaseResponse.Content.Headers.ContentType. it is even being removed from $response.RawContent . it happens regardless of usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markekraus |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| 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 | 1b5a9c55f39dd27607a574cdc272552f20236b44 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width