public static Task <IActionResult> ToOptionsResult <TInput>( this IOutputPipe <TInput> pipe, params HttpVerb[] verbs) where TInput : class { var httpContextStorage = pipe.GetService <IScopedStorage <HttpContext> >(); var httpVerbMap = pipe.GetService <IHttpVerbMap>(); IPipe resultPipe = new OptionsResultPipe <TInput>( input => verbs, httpVerbMap, httpContextStorage, pipe); return(resultPipe.Execute()); }
public static Task <IActionResult> ToOptionsResult <TInput>( this IOutputPipe <TInput> pipe, Func <IAllowedOptionsBuilder <TInput>, IAllowedOptionsBuilder <TInput> > builder) where TInput : class { var allowedOptionsBuilder = pipe.GetService <IAllowedOptionsBuilder <TInput> >(); var httpContextStorage = pipe.GetService <IScopedStorage <HttpContext> >(); var httpVerbMap = pipe.GetService <IHttpVerbMap>(); IPipe resultPipe = new OptionsResultPipe <TInput>( input => builder(allowedOptionsBuilder).GenerateAllowedVerbs(input), httpVerbMap, httpContextStorage, pipe); return(resultPipe.Execute()); }