Skip to content

Conversation

JustinGrote
Copy link
Contributor

@JustinGrote JustinGrote commented Apr 28, 2025

PR Summary

  • Log Request and Response Headers when -Debug is specified
  • Log Body when -DebugRequestContent is specified

PR Context

Closes #23879

PR Checklist

@JustinGrote JustinGrote marked this pull request as draft April 29, 2025 04:02
try
{
//NOTE: Because the request content is directly stringified via HttpResponseMessage, there's no need to do a culture format, it has already been performed.
WriteDebug(request.ToString());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to start only with this in the PR and remove all new code below.

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Apr 29, 2025
@JustinGrote JustinGrote force-pushed the justingrote/feature/webRequestLogging branch from 1221e9f to 580a97b Compare April 29, 2025 17:07
@JustinGrote JustinGrote requested a review from iSazonov April 29, 2025 17:08
@JustinGrote JustinGrote force-pushed the justingrote/feature/webRequestLogging branch 2 times, most recently from d40f1c8 to d836f7c Compare April 29, 2025 18:25
@JustinGrote
Copy link
Contributor Author

@iSazonov requested changes implemented. I also added response logging per the original issue specification.
image

@JustinGrote JustinGrote marked this pull request as ready for review April 29, 2025 18:53
@iSazonov
Copy link
Collaborator

@JustinGrote Please fix CodeFactor issues.

@JustinGrote JustinGrote force-pushed the justingrote/feature/webRequestLogging branch from d836f7c to fdd1bb7 Compare April 30, 2025 22:00
@JustinGrote
Copy link
Contributor Author

@iSazonov done.

@iSazonov iSazonov self-assigned this May 1, 2025
@iSazonov

This comment was marked as outdated.

This comment was marked as outdated.

@iSazonov iSazonov changed the title Improve Debug Logging of Web Cmdlet Requests Improve debug logging of Web cmdlet request and response May 1, 2025
@iSazonov iSazonov merged commit 9153f8a into PowerShell:master May 1, 2025
44 checks passed
@iSazonov
Copy link
Collaborator

iSazonov commented May 1, 2025

@JustinGrote Thanks for your contribution!
I hope you continue to discuss with community what we can improve on this debug output.

@JustinGrote JustinGrote deleted the justingrote/feature/webRequestLogging branch May 1, 2025 18:26
@JustinGrote
Copy link
Contributor Author

@iSazonov thanks for your time and patience of the review, I am well aware of the commitment it requires on your side and it is valued and appreciated.

I have filed two follow-on issues for the reasonings we discussed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show payload being sent when using verbose with Invoke-RestMethod and Invoke-WebRequest

2 participants