ngx-export-tools-extra 0.4.1.0 → 0.4.1.1
raw patch · 3 files changed
+31/−30 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- NgxExport/Tools/EDE.hs +4/−7
- NgxExport/Tools/Subrequest.hs +26/−22
- ngx-export-tools-extra.cabal +1/−1
NgxExport/Tools/EDE.hs view
@@ -36,7 +36,6 @@ #endif import qualified Data.HashMap.Strict as HM import Data.HashMap.Strict (HashMap)-import qualified Data.ByteString as B import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C8 import qualified Data.ByteString.Lazy as L@@ -69,14 +68,12 @@ -- -- ==== File /test_tools_extra_ede.hs/ -- @--- {-\# OPTIONS_GHC -Wno-unused-imports \#-}--- -- {-\# LANGUAGE TemplateHaskell \#-} -- -- module TestToolsExtraEDE where -- -- import NgxExport--- import NgxExport.Tools.EDE+-- import NgxExport.Tools.EDE () -- -- import Data.ByteString (ByteString) -- import qualified Data.ByteString.Lazy as L@@ -92,8 +89,8 @@ -- cookies. Notice that we are not using any Haskell declarations from module -- /NgxExport.Tools.EDE/ while still need to import this to access the three -- handlers from the Nginx configuration. This situation is quite valid though--- not usual to /ghc/, and to make it keep silence, pragma--- /OPTIONS_GHC -Wno-unused-imports/ was added on the top of the file.+-- not usual to /ghc/, and to make it keep silence, an explicit empty import+-- list was added at the end of the import stanza. -- -- ==== File /nginx.conf/ -- @@@ -209,7 +206,7 @@ -- > User id: user1, options: WyJvcDEiLCJvcDIiXQ==, path: %2Fopt%2Fusers type InputTemplates = (FilePath, [(ByteString, ByteString)])-type Templates = HashMap B.ByteString (Result Template)+type Templates = HashMap ByteString (Result Template) newtype EDERenderError = EDERenderError String
NgxExport/Tools/Subrequest.hs view
@@ -472,9 +472,8 @@ -- The same as 'makeSubrequest' except it returns a binary encoded response data -- whose parts must be extracted by handlers made of -- 'extractStatusFromFullResponse', 'extractHeaderFromFullResponse', and--- 'extractBodyFromFullResponse'.------ Exported on the Nginx level by a handler of the same name.+-- 'extractBodyFromFullResponse'. Exported on the Nginx level by handler+-- /makeSubrequestFull/. makeSubrequestFull :: ByteString -- ^ Subrequest configuration -> IO L.ByteString@@ -489,9 +488,8 @@ -- The same as 'makeSubrequestWithRead' except it returns a binary encoded -- response data whose parts must be extracted by handlers made of -- 'extractStatusFromFullResponse', 'extractHeaderFromFullResponse', and--- 'extractBodyFromFullResponse'.------ Exported on the Nginx level by a handler of the same name.+-- 'extractBodyFromFullResponse'. Exported on the Nginx level by handler+-- /makeSubrequestFullWithRead/. makeSubrequestFullWithRead :: ByteString -- ^ Subrequest configuration -> IO L.ByteString@@ -503,11 +501,12 @@ -- | Extracts the HTTP status from an encoded response. ----- Must be used to extract response data encoded by 'makeSubrequestFull' and--- 'makeSubrequestFullWithRead'.------ Exported on the Nginx level by a handler of the same name.-extractStatusFromFullResponse :: ByteString -> L.ByteString+-- Must be used to extract response data encoded by 'makeSubrequestFull' or+-- 'makeSubrequestFullWithRead'. Exported on the Nginx level by handler+-- /extractStatusFromFullResponse/.+extractStatusFromFullResponse+ :: ByteString -- ^ Encoded HTTP response+ -> L.ByteString extractStatusFromFullResponse = C8L.pack . show . (\(a, _, _) -> a) . (Binary.decode @FullResponse) . L.fromStrict @@ -515,13 +514,17 @@ -- | Extracts a specified header from an encoded response. ----- Must be used to extract response data encoded by 'makeSubrequestFull' and--- 'makeSubrequestFullWithRead'. Expects that the encoded response data is--- attached after the name of the header and a vertical bar such as--- /Header-Name|$hs_body/. The lookup of the header name is case-insensitive.+-- Must be used to extract response data encoded by 'makeSubrequestFull' or+-- 'makeSubrequestFullWithRead'. Exported on the Nginx level by handler+-- /extractHeaderFromFullResponse/. ----- Exported on the Nginx level by a handler of the same name.-extractHeaderFromFullResponse :: ByteString -> L.ByteString+-- Expects that the encoded response data is attached after the name of the+-- header and a vertical bar such as /Header-Name|$hs_body/. The lookup of the+-- header name is case-insensitive. Returns an empty value if the header was not+-- found.+extractHeaderFromFullResponse+ :: ByteString -- ^ Encoded HTTP response+ -> L.ByteString extractHeaderFromFullResponse v = let (h, b) = mk *** C8.tail $ C8.break ('|' ==) v hs = (\(_, a, _) -> map (first mk) a) $@@ -532,11 +535,12 @@ -- | Extracts the body from an encoded response. ----- Must be used to extract response data encoded by 'makeSubrequestFull' and--- 'makeSubrequestFullWithRead'.------ Exported on the Nginx level by a handler of the same name.-extractBodyFromFullResponse :: ByteString -> L.ByteString+-- Must be used to extract response data encoded by 'makeSubrequestFull' or+-- 'makeSubrequestFullWithRead'. Exported on the Nginx level by handler+-- /extractBodyFromFullResponse/.+extractBodyFromFullResponse+ :: ByteString -- ^ Encoded HTTP response+ -> L.ByteString extractBodyFromFullResponse = (\(_, _, a) -> a) . (Binary.decode @FullResponse) . L.fromStrict
ngx-export-tools-extra.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-tools-extra-version: 0.4.1.0+version: 0.4.1.1 synopsis: More extra tools for Nginx haskell module description: More extra tools for <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.