-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
Currently staticfile consists of two main features:
- Given a filepath, serve a file with proper etag headers, handle if-match, range requests, etc. automatically (no idea if all of this is actually implemented)
- Given a folder, map all requests to a file within that folder
Currently staticfile exposes only 2., I'd like it to expose 1. as completely independent feature, for cases where I want to write the logic that maps from request URL to filepath myself.
Flask has a send_file function, which takes an absolute filepath (and implicitly a request) and gives back a response. Here's my API proposal for Iron:
send_file<P: AsRef<Path>>(&Request, P) -> IronResult<Response>
Perhaps returning a IronResult<T> where T: Modifier` is more consistent with the rest of core-Iron's API, but I seriously doubt the usefulness of that.