Skip to content

Conversation

@markekraus
Copy link
Contributor

@markekraus markekraus commented Sep 19, 2017

  • Add Encoding/Utf8 test to WebListener
  • Replace tests using httpbin.org/encoding/utf8 with Weblistener URL
  • removed superfluous Invoke-RestMethod test. I'm not sure what the test was originally meant to accomplish but there is not an equivalent Invoke-WebRequest test and there are already other tests for Invoke-RestMethod which test text/html responses. httpbin.org/encoding/utf8 did not return text/plain anyway. *shrugs

reference #2504

@msftclas
Copy link

@markekraus,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be "text/html"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh... fixed. thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add newline at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@TravisEz13 TravisEz13 self-assigned this Sep 19, 2017
@TravisEz13
Copy link
Member

Tests failed due to a "spelling" error: https://travis-ci.org/PowerShell/PowerShell/jobs/277524298#L4389

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test sufficient? Do we really check Utf8 not Utf16/32 here?
Can we also protect from changing the encoding of this file? Does it make sense use `u{...} ?
The source file contains text in many languages. Does it make sense to ckeck multiple languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't clear on what the original tests were trying to accomplish and I'm not proficient with encoding to know what is a good test or not. It was clear to me that they were definitely not sufficient for UTF8, so I tried to add something that would at least eliminate ASCII. After the response headers are available for Invoke-RestMethod, it would be possible to test the response encoding similar to the Invoke-WebRequest. But I'm definitely open to suggestion on how to improve these tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the source file. If we can narrow down a specific UTF8 character or string, We can switch to generating the string from the controller and remove the view. That way we do not need to worry about the encoding change. I'd need guidance on what to put there, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an improvement over what we had before. If you think the tests can be further improved, perhaps an issue would be a better way to address the feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good. If my research on this is correct, It's no easy task to test a string for its encoding This at least include some UTf8 chars.

Opened #4890 for further improvements

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for open tracking Issue!

Closed.

@TravisEz13
Copy link
Member

@adityapatwardhan Can you update your review?

Copy link
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markekraus Thanks for your contribution!

@TravisEz13 TravisEz13 merged commit 65cf571 into PowerShell:master Sep 22, 2017
@markekraus markekraus deleted the HttpBinEncodingUtf8 branch September 22, 2017 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants