happstack-server 6.2.4 → 6.2.5
raw patch · 3 files changed
+25/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Happstack.Server.Response: prettyResponse :: Response -> String
+ Happstack.Server.SURI: instance [overlap ok] ToSURI Text
Files
- happstack-server.cabal +1/−1
- src/Happstack/Server/Response.hs +20/−0
- src/Happstack/Server/SURI.hs +4/−1
happstack-server.cabal view
@@ -1,5 +1,5 @@ Name: happstack-server-Version: 6.2.4+Version: 6.2.5 Synopsis: Web related tools and services. Description: Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html> License: BSD3
src/Happstack/Server/Response.hs view
@@ -14,6 +14,7 @@ , unauthorized , forbidden , notFound+ , prettyResponse , requestEntityTooLarge , seeOther , found@@ -301,3 +302,22 @@ tempRedirect :: (FilterMonad Response m, ToSURI a) => a -> res -> m res tempRedirect val res = do modifyResponse $ redirect 307 val return res++-- | A nicely formatted rendering of a 'Response'+prettyResponse :: Response -> String+prettyResponse res@Response{} =+ showString "================== Response ================" .+ showString "\nrsCode = " . shows (rsCode res) .+ showString "\nrsHeaders = " . shows (rsHeaders res) .+ showString "\nrsFlags = " . shows (rsFlags res) .+ showString "\nrsBody = " . shows (rsBody res) .+ showString "\nrsValidator = " $ show (rsValidator res)+prettyResponse res@SendFile{} =+ showString "================== Response ================" .+ showString "\nrsCode = " . shows (rsCode res) .+ showString "\nrsHeaders = " . shows (rsHeaders res) .+ showString "\nrsFlags = " . shows (rsFlags res) .+ showString "\nrsValidator = " . shows (rsValidator res).+ showString "\nsfFilePath = " . shows (sfFilePath res) .+ showString "\nsfOffset = " . shows (sfOffset res) .+ showString "\nsfCount = " $ show (sfCount res)
src/Happstack/Server/SURI.hs view
@@ -3,6 +3,8 @@ module Happstack.Server.SURI where import Data.Maybe import Data.Generics+import qualified Data.Text as Text+import qualified Data.Text.Lazy as LazyText import Happstack.Util.Common(mapFst) import qualified Network.URI as URI @@ -66,7 +68,8 @@ instance ToSURI URI.URI where toSURI=SURI instance ToSURI String where toSURI = maybe (SURI $ URI.URI "" Nothing "" "" "") id . parse-+instance ToSURI Text.Text where toSURI = toSURI . Text.unpack+instance ToSURI LazyText.Text where toSURI = toSURI . LazyText.unpack --handling obtaining things from URI paths class FromPath x where fromPath::String->x