Skip to content

std::http::static_files

Status: experimental

Caching static-file handler: ETag, Last-Modified, byte ranges, MIME sniff.

API details and source

The implementation source contains the complete declarations and implementation notes. The table below lists canonical Gossamer call signatures; every item name links directly to its implementation file.

Item Canonical signature or declaration Description
FileServer type FileServer Static-file handler rooted at a directory (Rust-side; streaming).
mime_for_path fn mime_for_path(path: String) -> String Guess a MIME type from a file path's extension. Available in interp + compiled.
serve_file fn serve_file(path: String) -> Result<http::Response, errors::Error> Read a single file and return it as a Response struct. Interp tier.