示例#1
0
        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();
            }
示例#3
0
 void InitializeFrom(MethodOverrideOptions options)
 {
     methodOverride = options.Create();
 }
示例#4
0
 MethodOverrideOptions CopyTo(MethodOverrideOptions options)
 {
     options.MethodBody = methodOverride.MethodBody;
     options.MethodDeclaration = methodOverride.MethodDeclaration;
     return options;
 }