Function hyper_staticfile::resolve[][src]

pub async fn resolve<B>(
    root: impl Into<PathBuf>,
    req: &Request<B>
) -> Result<ResolveResult, IoError>
Expand description

Resolve the request by trying to find the file in the given root.

This root may be absolute or relative. The request is mapped onto the filesystem by appending its URL path to the root path. If the filesystem path corresponds to a regular file, the service will attempt to serve it. Otherwise, if the path corresponds to a directory containing an index.html, the service will attempt to serve that instead.

The returned future may error for unexpected IO errors, passing on the std::io::Error. Certain expected IO errors are handled, though, and simply reflected in the result. These are NotFound and PermissionDenied.