iron / iron/staticfile

Split staticfile into two APIs

Open
#87 16 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
66
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Currently staticfile consists of two main features:
1. 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)
2. 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>(&Request, P) -> IronResult
```

Perhaps returning a `IronResult` where T: Modifier` is more consistent with the rest of core-Iron's API, but I seriously doubt the usefulness of that.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.