Skip to content

Document WebResponseObject/BasicHtmlWebResponseObject properties - #11876

Merged
Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
kevinoid:doc-WebResponseObject
Mar 23, 2020
Merged

Aditya Patwardhan (adityapatwardhan) merged 2 commits into
PowerShell:masterfrom
kevinoid:doc-WebResponseObject

Conversation

@kevinoid

Copy link
Copy Markdown
Contributor

PR Summary

Improve xmldoc comments for properties of WebResponseObject and BasicHtmlWebResponseObject.

PR Context

I found the current documentation to be unhelpful for understanding the values returned by Invoke-WebRequest. This PR contains my current understanding after examining the code. Feel free to modify or rewrite to better fit your preferred style.

PR Checklist

The properties of WebResponseObject and BasicHtmlWebResponseObject had
xmldoc comments which were not particularly informative.  Add more
informative comments to help users better understand the values returned
by these properties.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
@adityapatwardhan

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) please rebuild all

@PoshChan

Copy link
Copy Markdown
Collaborator

Aditya Patwardhan (@adityapatwardhan), successfully started rebuild of PowerShell-CI-static-analysis, PowerShell-CI-Windows, PowerShell-CI-macOS, PowerShell-CI-Linux

@kevinoid

Kevin Locke (kevinoid) commented Feb 19, 2020 •

Copy link
Copy Markdown
Contributor Author

I should also mention that .Content and .RawContentStream contain only the response content, while .RawContent contains status, headers, and content. I tried to make that clear in the comments, but I suspect it will still catch users by surprise. Assuming this is intentional and none of the properties will be deprecated, would bold be appropriate to draw attention to this difference?

@kevinoid

Copy link
Copy Markdown
Contributor Author

Also, since BasicHtmlWebResponseObject doesn't override .ToString(), it will differ from .Content and .RawContent since it contains the response content decoded as ASCII with non-printable characters removed. Although it meets the definition of a "string representation", which is all that it is documented to return, I worry it may also catch users by surprise if they write code which uses ToString().

@iSazonov Ilya (iSazonov) added the CL-Docs Indicates that a PR should be marked as a documentation change in the Change Log label Feb 19, 2020
@iSazonov Ilya (iSazonov) added this to the 7.1.0-preview.1 milestone Feb 19, 2020
Co-Authored-By: Ilya <darpa@yandex.ru>
@adityapatwardhan

Copy link
Copy Markdown
Member

Kevin Locke (@kevinoid) Thank you for your contribution!

@kevinoid

Copy link
Copy Markdown
Contributor Author

My pleasure. Thanks for reviewing and merging Aditya Patwardhan (@adityapatwardhan)!

@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.2 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Docs Indicates that a PR should be marked as a documentation change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants