using System.Threading.Tasks; namespace EmbedIO.Files { /// /// Provides standard handler callbacks for . /// /// public static class FileRequestHandler { #pragma warning disable CA1801 // Unused parameters - Must respect FileRequestHandlerCallback signature. /// /// Unconditionally passes a request down the module chain. /// /// An interface representing the context of the request. /// If the requested path has been successfully mapped to a resource (file or directory), the result of the mapping; /// otherwise, . /// This method never returns; it throws an exception instead. public static Task PassThrough(IHttpContext context, MappedResourceInfo? info) => throw RequestHandler.PassThrough(); /// /// Unconditionally sends a 403 Unauthorized response. /// /// An interface representing the context of the request. /// If the requested path has been successfully mapped to a resource (file or directory), the result of the mapping; /// otherwise, . /// This method never returns; it throws a instead. public static Task ThrowUnauthorized(IHttpContext context, MappedResourceInfo? info) => throw HttpException.Unauthorized(); /// /// Unconditionally sends a 404 Not Found response. /// /// An interface representing the context of the request. /// If the requested path has been successfully mapped to a resource (file or directory), the result of the mapping; /// otherwise, . /// This method never returns; it throws a instead. public static Task ThrowNotFound(IHttpContext context, MappedResourceInfo? info) => throw HttpException.NotFound(); /// /// Unconditionally sends a 405 Method Not Allowed response. /// /// An interface representing the context of the request. /// If the requested path has been successfully mapped to a resource (file or directory), the result of the mapping; /// otherwise, . /// This method never returns; it throws a instead. public static Task ThrowMethodNotAllowed(IHttpContext context, MappedResourceInfo? info) => throw HttpException.MethodNotAllowed(); #pragma warning restore CA1801 } }