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 =