serverless-haskell 0.12.5 → 0.12.6
raw patch · 4 files changed
+27/−7 lines, 4 filesdep +containers
Dependencies added: containers
Files
- README.md +1/−2
- serverless-haskell.cabal +4/−2
- src/AWSLambda/Events/APIGateway.hs +21/−2
- test/Data/Aeson/TestUtil.hs +1/−1
README.md view
@@ -50,7 +50,7 @@ stack new mypackage ``` - LTS 9-16 are supported, older versions are likely to work too but untested.+ LTS 10-17 are supported, older versions are likely to work too but untested. * Initialise a Serverless project inside the Stack package directory and install the `serverless-haskell` plugin:@@ -187,7 +187,6 @@ * Ensure you have the required dependencies: - `curl` - [jq]- - `libpcre` headers (`-devel` package or similar) - [NPM] - [`pkg-config`](pkg-config) - `pwgen`
serverless-haskell.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 682a2c75a4d9ecd3a633b59efd64c7d83b047d7b2912538bf20af0340150c613+-- hash: dba9305f286c65461f62ebbac33391809c4217648e4f99eb4b97277fc888d978 name: serverless-haskell-version: 0.12.5+version: 0.12.6 synopsis: Deploying Haskell code onto AWS Lambda using Serverless description: Utilities to help process the events from AWS Lambda when deployed with the serverless-haskell plugin. category: AWS, Cloud, Network@@ -54,6 +54,7 @@ , base >=4.7 && <5 , bytestring , case-insensitive+ , containers , http-client , http-types , iproute@@ -90,6 +91,7 @@ , base >=4.7 && <5 , bytestring , case-insensitive+ , containers , hspec , hspec-discover , http-client
src/AWSLambda/Events/APIGateway.hs view
@@ -34,9 +34,11 @@ import Data.Aeson.Types (Parser) import Data.ByteString (ByteString) import qualified Data.CaseInsensitive as CI+import Data.Function (on) import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap import Data.IP+import qualified Data.Set as Set import qualified Data.Text as Text import Data.Text.Encoding (decodeUtf8, encodeUtf8) import GHC.Generics (Generic)@@ -132,8 +134,21 @@ , _agprqStageVariables :: !(HashMap StageVarName StageVarValue) , _agprqRequestContext :: !ProxyRequestContext , _agprqBody :: !(Maybe (TextValue body))- } deriving (Eq, Show, Generic)+ } deriving (Show, Generic) +instance Eq body => Eq (APIGatewayProxyRequest body) where+ (==) =+ (==) `on` \rq ->+ ( _agprqResource rq+ , _agprqPath rq+ , _agprqHttpMethod rq+ , Set.fromList (_agprqHeaders rq) -- header order doesn't matter+ , _agprqQueryStringParameters rq+ , _agprqPathParameters rq+ , _agprqStageVariables rq+ , _agprqRequestContext rq+ , _agprqBody rq)+ instance FromText body => FromJSON (APIGatewayProxyRequest body) where parseJSON = withObject "APIGatewayProxyRequest" $ \o -> APIGatewayProxyRequest@@ -176,7 +191,11 @@ { _agprsStatusCode :: !Int , _agprsHeaders :: !HTTP.ResponseHeaders , _agprsBody :: !(Maybe (TextValue body))- } deriving (Eq, Show, Generic)+ } deriving (Show, Generic)++instance (Eq body) => Eq (APIGatewayProxyResponse body) where+ -- header order doesn't matter+ (==) = (==) `on` \r -> (_agprsStatusCode r, Set.fromList (_agprsHeaders r), _agprsBody r) instance ToText body => ToJSON (APIGatewayProxyResponse body) where toJSON APIGatewayProxyResponse {..} =
test/Data/Aeson/TestUtil.hs view
@@ -10,4 +10,4 @@ it "decodes" $ decode bytestring `shouldBe` Just value it "encodes" $- encode value `shouldBe` bytestring+ decode (encode value) `shouldBe` Just value