Closed madhub closed 4 years ago
Same here. I found your example:
var builder = new WebHostBuilder()
.Configure(app => app.UseCorrelationId())
.ConfigureServices(sc => sc.AddCorrelationId());
var server = new TestServer(builder);
var response = server.CreateClient().GetAsync("").GetAwaiter().GetResult();
var expectedHeaderName = new CorrelationIdOptions().Header;
var header = response.Headers.GetValues(expectedHeaderName);
However, I don't get how I can set up my HttpClientFactory to include Correlation ID in all my outgoing HTTP Client requests.
Consider using header propagation instead; https://gist.github.com/davidfowl/c34633f1ddc519f030a1c0c5abe8e867
Just a thought :-)
@ajtowf Agree that is a good option. I've added a feature to support basic header forwarding directly from this library if people prefer to use that.
I was reading your articles of
HttpClientFactory
usage in AspNet Core 2.1 , I was thinking we can add "X-Correlation-ID" header automatically to outgoing HTTP Client request viaHttpClientFactory
&DelegatingHandlers
. Is this a possibility ?