Communication
Add this feature using AddCommunication()
extension;
app.Features.AddCommunication(...);
HTTP
This feature provides an IClient<>
implementation and adds descriptors for
configured named clients from app.settings
c => c.Http()
"Communication": {
"Http": {
"MyService": {
"BaseAddress": "http://api.backend.com",
"DefaultHeaders": {
"User-Agent": ".NET HTTP Client"
}
}
}
}
Mock
Adds a mock implementation to be used in testing with MockClientConfiguration
communication: c => c.Mock(defaultResponses: response =>
{
response.ForClient<MyService>("""{ "value": "test result" }""");
response.ForClient<MyOtherService>(new { value = "path1 response" }, when: r => r.UrlOrPath.Equals("path1"));
})