Skip to content

Commit ea8de36

Browse files
committed
feedback
1 parent 6d8ccf7 commit ea8de36

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Middleware/HeaderPropagation/src/HeaderPropagationMessageHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage reques
4949
var message =
5050
$"The {nameof(HeaderPropagationValues)}.{nameof(HeaderPropagationValues.Headers)} property has not been " +
5151
$"initialized. Register the header propagation middleware by adding 'app.{nameof(HeaderPropagationApplicationBuilderExtensions.UseHeaderPropagation)}()' " +
52-
$"in the 'Configure(...)' method. Also, do not use an HttpClient with header propagation outside of an incoming HTTP request.";
52+
$"in the 'Configure(...)' method. Header propagation can only be used within the context of an HTTP request.";
5353
throw new InvalidOperationException(message);
5454
}
5555

src/Middleware/HeaderPropagation/test/HeaderPropagationIntegrationTest.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public async Task HeaderPropagation_WithoutMiddleware_Throws()
6464
Assert.IsType<InvalidOperationException>(captured);
6565
Assert.Equal(
6666
"The HeaderPropagationValues.Headers property has not been initialized. Register the header propagation middleware " +
67-
"by adding 'app.UseHeaderPropagation()' in the 'Configure(...)' method. Also, do not use an HttpClient with header " +
68-
"propagation outside of an incoming HTTP request.",
67+
"by adding 'app.UseHeaderPropagation()' in the 'Configure(...)' method. Header propagation can only be used within " +
68+
"the context of an HTTP request.",
6969
captured.Message);
7070
}
7171

@@ -81,15 +81,13 @@ public async Task HeaderPropagation_OutsideOfIncomingRequest_Throws()
8181
});
8282
var serviceProvider = services.BuildServiceProvider();
8383

84-
// Act
84+
// Act & Assert
8585
var client = serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient("test");
8686
var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => client.GetAsync("http://localhost/"));
87-
88-
// Assert
8987
Assert.Equal(
9088
"The HeaderPropagationValues.Headers property has not been initialized. Register the header propagation middleware " +
91-
"by adding 'app.UseHeaderPropagation()' in the 'Configure(...)' method. Also, do not use an HttpClient with header " +
92-
"propagation outside of an incoming HTTP request.",
89+
"by adding 'app.UseHeaderPropagation()' in the 'Configure(...)' method. Header propagation can only be used within " +
90+
"the context of an HTTP request.",
9391
exception.Message);
9492
}
9593

0 commit comments

Comments
 (0)