// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.Builder
{
///
/// Extension methods for adding terminal middleware.
///
public static class RunExtensions
{
///
/// Adds a terminal middleware delagate to the application's request pipeline.
///
/// The instance.
/// A delegate that handles the request.
public static void Run(this IApplicationBuilder app, RequestDelegate handler)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (handler == null)
{
throw new ArgumentNullException(nameof(handler));
}
app.Use(_ => handler);
}
}
}