This site provides a machine-readable index at /llms.txt.

Skip to main content Skip to navigation

HtmlResponseRewritingProcessor Pennington.Infrastructure

Single IResponseProcessor that owns the HTML rewriting pipeline. Invokes every registered IHtmlResponseRewriter in Order order, parsing and serializing the shared AngleSharp document exactly once per response.

Before this orchestrator, xref resolution, locale prefixing, and base-URL rewriting each ran as their own IResponseProcessor with its own parse/serialize cycle and its own IBrowsingContext.

Properties

Order int
Execution order; lower values run earlier in the response pipeline.

Constructors

.ctor

#
public HtmlResponseRewritingProcessor(IEnumerable<IHtmlResponseRewriter> rewriters);

Initializes the orchestrator with the registered rewriters, ordered by Order.

Parameters

rewriters IEnumerable<IHtmlResponseRewriter>

Methods

ProcessAsync

#
public async Task<string> ProcessAsync(string responseBody, HttpContext context);

Transforms responseBody and returns the processed body.

Parameters

responseBody string
context HttpContext

Returns

Task<string>

ShouldProcess

#
public bool ShouldProcess(HttpContext context);

Returns true when this processor should run for the current request.

Parameters

context HttpContext

Returns

bool

Pennington.Infrastructure.HtmlResponseRewritingProcessor

namespace Pennington.Infrastructure;

/// Single IResponseProcessor that owns the HTML rewriting pipeline. Invokes every registered IHtmlResponseRewriter in Order order, parsing and serializing the shared AngleSharp document exactly once per response. Before this orchestrator, xref resolution, locale prefixing, and base-URL rewriting each ran as their own IResponseProcessor with its own parse/serialize cycle and its own IBrowsingContext.
public class HtmlResponseRewritingProcessor
{
    /// Initializes the orchestrator with the registered rewriters, ordered by Order.
    
public HtmlResponseRewritingProcessor(IEnumerable<IHtmlResponseRewriter> rewriters);
/// Execution order; lower values run earlier in the response pipeline.
public int Order => 10;
/// Transforms responseBody and returns the processed body.
public async Task<string> ProcessAsync(string responseBody, HttpContext context);
/// Returns true when this processor should run for the current request.
public bool ShouldProcess(HttpContext context);
}