Skip to content

HttpClient CustomFields #673

Answered by thepirat000
wboevink asked this question in Q&A
Jun 24, 2024 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

The IncludeOptions configuration was added in version 25.0.7.

For example:

services.AddHttpClient<IAuditHttpClient, AuditHttpClient>()
	.AddAuditHandler(audit =>
	{
	    audit.IncludeRequestBody();
	    audit.IncludeResponseBody();
            audit.IncludeOptions();
	});

Additionally, a new GetRequestMessage() method has been introduced in HttpAction to retrieve the current request message from the audit event. This enables you to achieve the same result with a custom action, such as

Audit.Core.Configuration.AddOnCreatedAction(scope =>
{
    var originalMessage = scope.GetHttpAction().GetRequestMessage();

    originalMessage.Options.TryGetValue(new HttpRequestOptionsKey<int>("ContextId"), 

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@wouter-b
Comment options

@thepirat000
Comment options

Comment options

You must be logged in to vote
1 reply
@wboevink
Comment options

Answer selected by wboevink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants