/// <summary> /// Allows incoming POST request to override method type with type specified in form. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> instance this method extends.</param> /// <param name="options">The <see cref="HttpMethodOverrideOptions"/>.</param> public static IApplicationBuilder UseHttpMethodOverride(this IApplicationBuilder builder, HttpMethodOverrideOptions options) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return builder.UseMiddleware<HttpMethodOverrideMiddleware>(Options.Create(options)); }
public HttpMethodOverrideMiddleware(RequestDelegate next, IOptions<HttpMethodOverrideOptions> options) { if (next == null) { throw new ArgumentNullException(nameof(next)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } _next = next; _options = options.Value; }
/// <summary> /// Allows incoming POST request to override method type with type specified in form. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> instance this method extends.</param> /// <param name="options">The <see cref="HttpMethodOverrideOptions"/>.</param> public static IApplicationBuilder UseHttpMethodOverride(this IApplicationBuilder builder, HttpMethodOverrideOptions options) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(builder.UseMiddleware <HttpMethodOverrideMiddleware>(Options.Create(options))); }