Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Created November 23, 2020 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitvijay/0d77595a367070ff359796e81101f092 to your computer and use it in GitHub Desktop.
Save ankitvijay/0d77595a367070ff359796e81101f092 to your computer and use it in GitHub Desktop.
Passing Correlation Id to subsequent request
public class Startup
{
public virtual void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient<IMyServiceClient, MyServiceClient>((serviceProvider, client) =>
{
client.BaseAddress = customerCoreServiceOptions.BaseUri;
client.DefaultRequestHeaders.Add("correlation-id",
CorrelationIdContext.GetCorrelationId() ??
Guid.NewGuid().ToString());
});
}
public void Configure(IApplicationBuilder app)
{
// Code removed for brevity
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment