Respond with 200 or 206 in ranged responses

This commit is contained in:
Joe Nelson
2014-09-07 09:38:30 -07:00
parent 7c93c788fa
commit 7802fa5b7e
6 changed files with 183 additions and 28 deletions
+11
View File
@@ -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")