IInProcessHttpDispatcher Pennington.Infrastructure
Dispatches HTTP requests against the running app's pipeline. Replaces the "self-fetch via Kestrel socket" pattern with a transport that the host can satisfy in-process (via Microsoft.AspNetCore.TestHost.TestServer) or over the wire (via Kestrel's listening address) depending on which IServer is registered.
Internal services (LlmsTxtService, SearchIndexService, build crawler) take this instead of IHttpClientFactory so they don't need to know whether the host is using TestServer (build / tests) or Kestrel (dev). The middleware pipeline runs identically either way — the only difference is who delivers the bytes.
Methods
CreateClient
#HttpClient CreateClient();Returns an HttpClient whose requests flow through the running app's pipeline.
Returns
HttpClientPennington.Infrastructure.IInProcessHttpDispatcher
namespace Pennington.Infrastructure;
/// Dispatches HTTP requests against the running app's pipeline. Replaces the "self-fetch via Kestrel socket" pattern with a transport that the host can satisfy in-process (via Microsoft.AspNetCore.TestHost.TestServer) or over the wire (via Kestrel's listening address) depending on which IServer is registered. Internal services (LlmsTxtService, SearchIndexService, build crawler) take this instead of IHttpClientFactory so they don't need to know whether the host is using TestServer (build / tests) or Kestrel (dev). The middleware pipeline runs identically either way — the only difference is who delivers the bytes.
public interface IInProcessHttpDispatcher
{
/// Returns an HttpClient whose requests flow through the running app's pipeline.
HttpClient CreateClient();
}