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
+14
View File
@@ -453,3 +453,17 @@ spec = do
{ matchStatus = 416
, matchHeaders = ["Content-Range" <:> "*/15"]
}
it "refuses a range with first position the same as number of items" $
request methodGet "/rpc/getitemrange?min=1&max=2"
(rangeHdrsWithCount $ ByteRangeFromTo 1 2) mempty
`shouldRespondWith`
[json| {
"message":"Requested range not satisfiable",
"code":"PGRST103",
"details":"An offset of 1 was requested, but there are only 1 rows.",
"hint":null
}|]
{ matchStatus = 416
, matchHeaders = ["Content-Range" <:> "*/1"]
}