Path: redb-route/redb.Route/Expressions/HeaderExpression.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Expressions/HeaderExpression.cs ---- using System; using redb.Route.Abstractions; namespace redb.Route.Expressions; /// /// Expression for accessing message headers in an . /// /// /// Allows extracting message header values /// for use in predicates and routing logic. /// public class HeaderExpression : Expression { private readonly string _headerName; /// /// Initializes a new instance of the class. /// /// The header name (case-sensitive). /// Thrown when is null. public HeaderExpression(string headerName) { _headerName = headerName ?? throw new ArgumentNullException(nameof(headerName)); } /// /// Thrown when is null. /// Thrown when the header type is not compatible with . /// Thrown when the header is not found. public override T Evaluate(IExchange exchange) { if (exchange == null) throw new ArgumentNullException(nameof(exchange)); return exchange.In.getHeader(_headerName); } /// /// Thrown when is null. public override void SetValue(IExchange exchange, object value) { if (exchange == null) throw new ArgumentNullException(nameof(exchange)); exchange.In.setHeader(_headerName, value); } /// public override string ToTemplateString() => $"${{header.{_headerName}}}"; }