fix: range request with first position same as length return status 206

This commit is contained in:
Taimoor Zaeem
2023-10-04 00:07:09 -03:00
committed by Steve Chavez
parent 6c8ce3929c
commit d7dfdaa03f
3 changed files with 18 additions and 3 deletions
+3 -3
View File
@@ -104,9 +104,9 @@ rangeStatusHeader topLevelRange queryTotal tableTotal =
rangeStatus :: Integer -> Integer -> Maybe Integer -> Status
rangeStatus _ _ Nothing = status200
rangeStatus lower upper (Just total)
| lower > total = status416 -- 416 Range Not Satisfiable
| (1 + upper - lower) < total = status206 -- 206 Partial Content
| otherwise = status200 -- 200 OK
| lower >= total && lower /= upper = status416 -- 416 Range Not Satisfiable
| (1 + upper - lower) < total = status206 -- 206 Partial Content
| otherwise = status200 -- 200 OK
contentRangeH :: (Integral a, Show a) => a -> a -> Maybe a -> Header
contentRangeH lower upper total =