Skip to content

Commit

Permalink
Fixup doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusGrass committed Jul 21, 2023
1 parent 36a082a commit fe31dfd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ mod macros;
/// syntactically correct ranges actually makes sense in context
///
/// The range `bytes=0-20` on a file with 15 bytes will be accepted in the first pass as the content_size is unknown.
/// On the second pass (`validate`) it will be rejected and produce an error
/// # Example range fails `validate` because it exceedes file boundaries
/// On the second pass (`validate`) it will be truncated to `file_size - 1` as per [the spec](https://httpwg.org/specs/rfc9110.html#rfc.section.14.1.2).
/// # Example range truncates in `validate` because it exceedes
/// ```
/// let input = "bytes=0-20";
/// let file_size_bytes = 15;
/// let parsed_ranges = http_range_header::parse_range_header(input)
/// // Is syntactically correct
/// .unwrap();
/// let validated = parsed_ranges.validate(file_size_bytes);
/// assert!(validated.is_err());
/// let validated = parsed_ranges.validate(file_size_bytes).unwrap();
/// assert_eq!(vec![0..=14], validated);
/// ```
///
/// Range reversal and overlap is also checked in the second pass, the range `bytes=0-20, 5-10`
Expand Down

0 comments on commit fe31dfd

Please sign in to comment.