aws-lambda-haskell-runtime-wai 1.0.0 → 1.0.1
raw patch · 4 files changed
+14/−13 lines, 4 files
Files
- ChangeLog.md +4/−1
- README.md +3/−1
- aws-lambda-haskell-runtime-wai.cabal +2/−2
- src/Aws/Lambda/Wai.hs +5/−9
ChangeLog.md view
@@ -1,3 +1,6 @@ # Changelog for aws-lambda-haskell-runtime-wai -## Unreleased changes+## 1.0.1++* Removed forgotten print statements+* Applied a [temporary hotfix](https://github.com/eir-forsakring/aws-lambda-haskell-runtime-wai/pull/4) for handling query parameters
README.md view
@@ -1,4 +1,4 @@-# aws-lambda-haskell-runtime-wai +# aws-lambda-haskell-runtime-wai [](http://hackage.haskell.org/package/aws-lambda-haskell-runtime-wai)  ## Quick start @@ -26,3 +26,5 @@ MyAppConfig { getWaiApp :: Application } ```++For a complete example see [theam/aws-lambda-haskell-runtime/tree/master/examples/wai-app](https://github.com/theam/aws-lambda-haskell-runtime/tree/master/examples/wai-app)
aws-lambda-haskell-runtime-wai.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 84d5705be40077a09e34d445f54b862f58447fa5abac05fd535936a3196c6bbb+-- hash: 498d2ba264befe7e4ff8899000c03f243a6c66ca69f706adf0d7feea4addeaa9 name: aws-lambda-haskell-runtime-wai-version: 1.0.0+version: 1.0.1 synopsis: Run wai applications on AWS Lambda description: Please see the README on GitHub at <https://github.com/eir-forsakring/aws-lambda-haskell-runtime-wai#readme> category: AWS
src/Aws/Lambda/Wai.hs view
@@ -48,14 +48,10 @@ (status, headers, body) <- processRequest waiApplication waiRequest >>= readResponse - print $ "Working: " <> ("Something went wai" :: ByteString)- print $ "Actual response body (before decodeUtf8'): " <> body- if BS.null body then return . pure . wrapInResponse (H.statusCode status) headers $ mempty else case decodeUtf8' body of- Right responseBodyText -> do- print $ "After decoding in wai: " <> responseBodyText+ Right responseBodyText -> return . pure . wrapInResponse (H.statusCode status) headers $ responseBodyText Left err -> error "Expected a response body that is valid UTF-8." @@ -118,10 +114,10 @@ Just bs -> pure bs Nothing -> pure BS.empty -toQueryStringParameters :: Maybe [(Text, Maybe Text)] -> [H.QueryItem]-toQueryStringParameters (Just params@(p:ps)) =- let toQueryItem (key, valueMay) = (encodeUtf8 key, encodeUtf8 <$> valueMay)- in map toQueryItem params+toQueryStringParameters :: Maybe (HMap.HashMap Text Text) -> [H.QueryItem]+toQueryStringParameters (Just params) =+ let toQueryItem (key, value) = (encodeUtf8 key, Just $ encodeUtf8 value)+ in map toQueryItem $ HMap.toList params toQueryStringParameters _ = [] parseIp :: Maybe Text -> IO Socket.SockAddr