Added ByteStringResponse and TODO list

This commit is contained in:
Michael Snoyman 2009-09-18 13:29:08 +03:00
parent c75c72d9cb
commit 649661e133
2 changed files with 8 additions and 0 deletions

2
TODO Normal file
View File

@ -0,0 +1,2 @@
Static files and directories
Better error handling for invalid arguments (currently 500 error)

View File

@ -31,6 +31,7 @@ module Web.Restful.Response
, liftIO
, ErrorResult (..)
, HasRepsW (..)
, byteStringResponse
) where
import Data.ByteString.Class
@ -185,11 +186,16 @@ instance HasReps () where
data GenResponse = HtmlResponse String
| ObjectResponse Object
| HtmlOrObjectResponse String Object
| ByteStringResponse ContentType B.ByteString
instance HasReps GenResponse where
reps (HtmlResponse h) = [("text/html", toLazyByteString h)]
reps (ObjectResponse t) = reps t
reps (HtmlOrObjectResponse h 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
reps o =