<commit_before>using System;
using Microsoft.AspNetCore.Hosting;
using TwentyTwenty.Mvc;
using TwentyTwenty.Mvc.ErrorHandling;
using TwentyTwenty.Mvc.HealthCheck;
using TwentyTwenty.Mvc.ReadOnlyMode;

namespace Microsoft.AspNetCore.Builder
{
    public static class ErrorHandling
    {
        public static void UseErrorHandling(this IApplicationBuilder app, ICodeMap codeMap)
            => app.UseErrorHandling(codeMap.MapErrorCode);

        public static void UseErrorHandling(this IApplicationBuilder app, Func<int, int> codeMap = null)
        {
            app.UseMiddleware<ErrorHandlerMiddleware>(codeMap);
        }

        public static void UseHealthCheck(this IApplicationBuilder app)
            => app.UseHealthCheck("/status/health-check");

        public static void UseHealthCheck(this IApplicationBuilder app, string path)
        {
            app.Map(path, builder =>
            {
                builder.UseMiddleware<HealthCheckMiddleware>();
            });
        }

        public static void UseReadOnlyMode(this IApplicationBuilder app)
        {
            app.UseMiddleware<ReadOnlyModeMiddleware>();
        }
    }
}<commit_msg>Add extension method for using version header middleware.<commit_after>using System;
using Microsoft.AspNetCore.Hosting;
using TwentyTwenty.Mvc;
using TwentyTwenty.Mvc.ErrorHandling;
using TwentyTwenty.Mvc.HealthCheck;
using TwentyTwenty.Mvc.ReadOnlyMode;
using TwentyTwenty.Mvc.Version;

namespace Microsoft.AspNetCore.Builder
{
    public static class ErrorHandling
    {
        public static void UseErrorHandling(this IApplicationBuilder app, ICodeMap codeMap)
            => app.UseErrorHandling(codeMap.MapErrorCode);

        public static void UseErrorHandling(this IApplicationBuilder app, Func<int, int> codeMap = null)
        {
            app.UseMiddleware<ErrorHandlerMiddleware>(codeMap);
        }

        public static void UseHealthCheck(this IApplicationBuilder app)
            => app.UseHealthCheck("/status/health-check");

        public static void UseHealthCheck(this IApplicationBuilder app, string path)
        {
            app.Map(path, builder =>
            {
                builder.UseMiddleware<HealthCheckMiddleware>();
            });
        }

        public static void UseReadOnlyMode(this IApplicationBuilder app)
        {
            app.UseMiddleware<ReadOnlyModeMiddleware>();
        }

        public static void UseVersionHeader(this IApplicationBuilder app, string headerName = "api-version")
        {
            app.UseMiddleware<VersionHeaderMiddleware>(headerName);
        }
    }
}
{'fraction_non_alphanumeric': 0.07789716039907905, 'fraction_numerical': 0.0, 'mean_word_length': 2.87369985141159, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3955429', 'n_tokens_mistral': 648, 'n_tokens_neox': 665, 'n_words': 145}