Respond with 200 or 206 in ranged responses
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module SpecHelper where
|
||||
|
||||
import Network.Wai
|
||||
@@ -8,6 +9,10 @@ import Database.HDBC.PostgreSQL
|
||||
|
||||
import Control.Exception.Base (bracket)
|
||||
|
||||
import Network.HTTP.Types.Header
|
||||
import Data.CaseInsensitive (CI(..))
|
||||
import qualified Data.ByteString.Char8 as BS
|
||||
|
||||
import Dbapi (app, AppConfig(..))
|
||||
|
||||
cfg :: AppConfig
|
||||
@@ -35,3 +40,9 @@ appWithFixture action = withDatabaseConnection $ \c -> do
|
||||
runRaw c "begin;"
|
||||
action $ app c
|
||||
rollback c
|
||||
|
||||
rangeHdrs :: ByteRange -> [Header]
|
||||
rangeHdrs r = [rangeUnit, (hRange, renderByteRange r)]
|
||||
|
||||
rangeUnit :: Header
|
||||
rangeUnit = ("Range-Unit" :: CI BS.ByteString, "items")
|
||||
|
||||
Reference in New Issue
Block a user