public MethodOverrideVM(MethodOverrideOptions options, ModuleDef ownerModule) { this.ownerModule = ownerModule; this.origOptions = options; Reinitialize(); }
static async Task ExecuteFeature(HttpContext c, MethodOverrideOptions o, Func <Task> next) { if (c.Request.Method.Equals(HttpMethods.Post, StringComparison.OrdinalIgnoreCase) && c.Request.Headers.TryGetValue(o.MethodOverrideHeader, out var header)) { var value = header.ToString(); if (o.AllowedMethodOverrides.Contains(value, StringComparer.OrdinalIgnoreCase)) { c.Request.Method = value; } } await next(); }
void InitializeFrom(MethodOverrideOptions options) { methodOverride = options.Create(); }
MethodOverrideOptions CopyTo(MethodOverrideOptions options) { options.MethodBody = methodOverride.MethodBody; options.MethodDeclaration = methodOverride.MethodDeclaration; return options; }