Respond with 200 or 206 in ranged responses
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Feature.RangeSpec where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.Hspec.Wai
|
||||
import Network.HTTP.Types
|
||||
|
||||
import SpecHelper
|
||||
|
||||
spec :: Spec
|
||||
spec = around appWithFixture $ do
|
||||
describe "GET /view" $
|
||||
spec = around appWithFixture $
|
||||
describe "GET /items" $ do
|
||||
context "without range headers" $
|
||||
context "with response under server size limit" $
|
||||
it "returns whole range with status 200" $
|
||||
get "/auto_incrementing_pk" `shouldRespondWith` 206
|
||||
get "/items" `shouldRespondWith` 200
|
||||
context "with range headers" $
|
||||
context "of acceptable range" $
|
||||
it "succeeds with partial content" $
|
||||
request methodGet "/items"
|
||||
(rangeHdrs $ ByteRangeFromTo 0 1) ""
|
||||
`shouldRespondWith` 206
|
||||
|
||||
Reference in New Issue
Block a user