gotham-rs / gotham

A flexible web framework that promotes stability, safety, security and speed.
https://gotham.rs
Other
2.24k stars 125 forks source link

assets: add range request support for FileHandler #628

Closed jpelkonen closed 11 months ago

jpelkonen commented 11 months ago

This adds range request support for FileHandler. This is a critical feature for handling large files, or any application that will require range request support, e.g. video or audio streaming.

This implementation currentyl only supports ranges that result in a single response, i.e. multiple ranges are not supported.

This implementation will return an error if a range is open from both ends, or if the range beginning is larger than the end.

jpelkonen commented 11 months ago

@msrd0 I appreciate your timely feedback and have addressed the issues raised in my latest commit. Thanks!

codecov[bot] commented 11 months ago

Codecov Report

Merging #628 (9ec7934) into main (702a03a) will increase coverage by 0.40%. The diff coverage is 97.67%.

@@            Coverage Diff             @@
##             main     #628      +/-   ##
==========================================
+ Coverage   78.33%   78.73%   +0.40%     
==========================================
  Files          72       72              
  Lines        2049     2088      +39     
==========================================
+ Hits         1605     1644      +39     
  Misses        444      444              
Files Coverage Δ
gotham/src/handler/assets/mod.rs 93.01% <97.67%> (+3.35%) :arrow_up:

... and 4 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more