From 649661e13351ce8d9ebfedc6c89508ca93ddfc3e Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Fri, 18 Sep 2009 13:29:08 +0300 Subject: [PATCH] Added ByteStringResponse and TODO list --- TODO | 2 ++ Web/Restful/Response.hs | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 00000000..7fb61ea3 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +Static files and directories +Better error handling for invalid arguments (currently 500 error) diff --git a/Web/Restful/Response.hs b/Web/Restful/Response.hs index 98fc13d8..f0db694b 100644 --- a/Web/Restful/Response.hs +++ b/Web/Restful/Response.hs @@ -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 =