[][src]Function hyper_staticfile::resolve_path

pub async fn resolve_path<'_>(
    root: impl Into<PathBuf>,
    request_path: &'_ str
) -> Result<ResolveResult, IoError>

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

This root may be absolute or relative. The request path is mapped onto the filesystem by appending it 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.

Note that, unlike resolve, it is up to the caller to check the request method.