GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add support for Content Headers to BasicHtmlWebResponseObject and HtmlWebResponseObject by markekraus · Pull Request #4494 · PowerShell/PowerShell Conversation
|
|
Mark Kraus (@markekraus), |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mark Kraus (@markekraus) Could you please add tests? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) Tests Added. I wasn't exactly sure what tests to add. There is already significant validation being done on the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Typo Wen
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) doh... corrected. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I agree with Ilya (@iSazonov) . The tests in the issue look like a good starting point. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Travis Plunk (@TravisEz13) Thanks. I added the 2 test that make sense. The other tests from the issue won't ever work unless CoreFX drastically changes their approach in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
73d19ed to
823dd03
Compare
|
Travis Plunk (@TravisEz13) Steve Lee (@SteveL-MSFT) Rebased PR on master to add test fixes from #4512. The new tests are passing. Let me know if I need to make any other changes. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
823dd03 to
75b6f54
Compare
| }; | ||
|
|
||
| foreach (var entry in response.Headers) | ||
| foreach(var headerCollection in headerCollections) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor point, insert a space after 'foreach' here and 'if' below to match the rest of the code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Dan Travison (@dantraMSFT) corrected.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| headers[entry.Key] = entry.Value; | ||
| } | ||
| if(BaseResponse.Content != null){ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor note: place '{' on a new line.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Dan Travison (@dantraMSFT) corrected, along with space between if and (.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| #endregion charset encoding tests | ||
|
|
||
| It "Verifies Invoke-WebRequest includes Content headers in Headers property" { | ||
| $command = "Invoke-WebRequest -Uri 'http://httpbin.org/get'" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Use HTTPListener here instead of http://httpbin.org/get.
The tests under Context "BasicHtmlWebResponseObject Encoding tests" illustrate using 'test=response&output=$otuput' to pass HTML you want to get in the response. You should consider extending httplistener's 'response' option to allow additional options, such as specifying a content-type header value or other headers to support your testing. let me know if you need any help with it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Dan Travison (@dantraMSFT) Thanks. I will work on this and submit more and better tests with your suggestions.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| #endregion charset encoding tests | ||
|
|
||
| It "Verifies Invoke-WebRequest includes Content headers in Headers property" { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think these two tests need to be either be extended or additional tests added.
1: I don't believe verifying the presence of the header is sufficient; I believe the test should verify the value(s) as well.
2: You added logic to support headers with multiple values so you need to test that case.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Dan Travison (@dantraMSFT) I have added the requested test changes and httplistener now supports a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| $statusCode = $queryItems["statuscode"] | ||
| $contentType = $queryItems["contenttype"] | ||
| $output = $queryItems["output"] | ||
| if ($queryItems['headers']) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to add a comment here that illustrates how the 'headers' value should be formatted; especially since this is the only documentation we have for the listener. :)
At a minimum, show the json structure. Even better would be to show a code sample similar to what you used in your tests.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Dan Travison (@dantraMSFT) added. comments with examples
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mark Kraus (@markekraus) Can you trigger of feature tests? They seems to have failed last time on Travis CI. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
42f5aca to
07d7b3d
Compare
|
Aditya Patwardhan (@adityapatwardhan) feature tag added. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Aditya Patwardhan (@adityapatwardhan) all tests passed this time. (last time an unrelated test hung accessing a 3rd party website). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM. Thanks for great work! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…lWebResponseObject (PowerShell#4494)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Invoke-WebRequest removes the Content-Type header from WebResponseObject's
There was an error while loading. Please reload this page.