Implement warp::reply::file for dynamic file service#1049
Implement warp::reply::file for dynamic file service#1049Molkars wants to merge 3 commits intoseanmonstar:masterfrom
warp::reply::file for dynamic file service#1049Conversation
…p::fs::Conditionals to warp::header
|
Awesome work, thanks! I think I have mainly one suggestion: make |
|
I'm not sure that's very feasible since we return a future dependent on the value initially passed in. We could have a reply::conditional_file though |
|
I've been using Molkar's version for a while now, and it works perfectly for my needs. How can we make this PR land into the main version? |
|
Any updates here? I'd love to have this feature |
same |
|
I'd independently hit this very issue when trying to build a file server that couldn't serve files. I'd imagined that warp would have the building blocks available to allow DIYing this, but AFAICT the only solution right now is to copy/paste a bunch of If anyone else stumbles upon this issue after hitting a brick wall like I had, I ended up just switching to using this instead: https://api.rocket.rs/master/rocket/fs/struct.FileServer.html |
This pull request implements
warp::reply::file,warp::header::conditionals, and publisheswarp::header::Conditionals. I also internally moves Conditionals to what I believe is a more fitting place (from fs to header).Fixes #171
Supersedes #924