Added ByteStringResponse and TODO list
This commit is contained in:
parent
c75c72d9cb
commit
649661e133
2
TODO
Normal file
2
TODO
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Static files and directories
|
||||||
|
Better error handling for invalid arguments (currently 500 error)
|
||||||
@ -31,6 +31,7 @@ module Web.Restful.Response
|
|||||||
, liftIO
|
, liftIO
|
||||||
, ErrorResult (..)
|
, ErrorResult (..)
|
||||||
, HasRepsW (..)
|
, HasRepsW (..)
|
||||||
|
, byteStringResponse
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.ByteString.Class
|
import Data.ByteString.Class
|
||||||
@ -185,11 +186,16 @@ instance HasReps () where
|
|||||||
data GenResponse = HtmlResponse String
|
data GenResponse = HtmlResponse String
|
||||||
| ObjectResponse Object
|
| ObjectResponse Object
|
||||||
| HtmlOrObjectResponse String Object
|
| HtmlOrObjectResponse String Object
|
||||||
|
| ByteStringResponse ContentType B.ByteString
|
||||||
instance HasReps GenResponse where
|
instance HasReps GenResponse where
|
||||||
reps (HtmlResponse h) = [("text/html", toLazyByteString h)]
|
reps (HtmlResponse h) = [("text/html", toLazyByteString h)]
|
||||||
reps (ObjectResponse t) = reps t
|
reps (ObjectResponse t) = reps t
|
||||||
reps (HtmlOrObjectResponse h t) =
|
reps (HtmlOrObjectResponse h t) =
|
||||||
("text/html", toLazyByteString h) : reps t
|
("text/html", toLazyByteString h) : reps t
|
||||||
|
reps (ByteStringResponse ct con) = [(ct, con)]
|
||||||
|
|
||||||
|
byteStringResponse :: LazyByteString lbs => ContentType -> lbs -> GenResponse
|
||||||
|
byteStringResponse ct = ByteStringResponse ct . toLazyByteString
|
||||||
|
|
||||||
instance HasReps Object where
|
instance HasReps Object where
|
||||||
reps o =
|
reps o =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user