Skip to content

Log HTTP Request and Response when Debug Switch is specified. - #232

Merged
George (georgend) merged 11 commits into
devfrom
httpDebugLogging
Jul 17, 2020
Merged

George (georgend) merged 11 commits into
devfrom
httpDebugLogging

Conversation

@georgend

@georgend George (georgend) commented May 18, 2020 •

Copy link
Copy Markdown
Contributor

Hook into Signal infrastructure to capture HTTP Request and Responses for logging purposes when Debug is specified.

On Module init, hook EventHandler delegate into EventListener delegate.
Use HttpFormatter from contrib repo. Does not show the Authorization header (Access Token).

Depends on changes in autorest.powershell generator

Covers task AB#4720

… for logging purposes when Debug is specified.

On Module init, hook EventHandler into EventListener delegate.
@georgend

Copy link
Copy Markdown
Contributor Author

Changes to AutoRest.Powershell have been reviewed and merged.

Comment thread tools/Custom/EventHelper.cs Resolved
Comment thread tools/Custom/EventHelper.cs Resolved
// Set of header fields that should not get serialized
private static readonly HashSet<string> _neverSerializedHeaderFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"SdkVersion",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we not Serializing SdkVersion and FeatureFlag? Or Cache-Control, or Date?

@georgend George (georgend) Jul 12, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is legacy from the contrib project. Would it be preferable to serialize all headers, including Authorization?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should serialize headers that are useful in tracing an issue/bug. For instance, we need SdkVersion to know which version of the SDK the customer was running, featureFlag to know which middleware handlers they have enabled e.t.c. Authorization header is not useful, and we shouldn't serialize it.

George and others added 2 commits July 14, 2020 05:37
use nameof in exceptions.
add appropriate license headers.
@georgend

Copy link
Copy Markdown
Contributor Author

Generated a sample module using the latest autorest.powershell that includes our code generator changes, generates correctly and -Debug emits Request and Responses accordingly.

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.

Update -debug to show complete HTTP request and response

3 participants