wai-handler-hal 0.1.2.0 → 0.2.0.0
raw patch · 4 files changed
+35/−28 lines, 4 filesdep ~aesondep ~basedep ~bytestringnew-uploader
Dependency ranges changed: aeson, base, bytestring, tasty, text
Files
- CHANGELOG.md +9/−4
- src/Network/Wai/Handler/Hal.hs +7/−6
- test/golden/WaiRequest.txt +15/−15
- wai-handler-hal.cabal +4/−3
CHANGELOG.md view
@@ -1,16 +1,21 @@ # Revision history for wai-handler-hal +## 0.2.0.0 -- 2023-03-17++- Breaking change: `toWaiRequest` now sorts request headers and query string+ parameters.+ ## 0.1.2.0 -- 2022-06-03 -* Fix construction of `rawPathInfo`.+- Fix construction of `rawPathInfo`. ## 0.1.1.0 -- 2021-10-14 -* When API Gateway sends nonsense IPs during a test invocation, sub in+- When API Gateway sends nonsense IPs during a test invocation, sub in `127.0.0.1` instead of exploding. [#3](https://github.com/bellroy/wai-handler-hal/issues/3)-* Removed debug `print`s left in by mistake.+- Removed debug `print`s left in by mistake. ## 0.1.0.0 -- 2021-04-15 -* First version. Released on an unsuspecting world.+- First version. Released on an unsuspecting world.
src/Network/Wai/Handler/Hal.hs view
@@ -58,7 +58,7 @@ import Data.HashMap.Lazy (HashMap) import qualified Data.HashMap.Lazy as H import qualified Data.IORef as IORef-import Data.List (foldl')+import Data.List (foldl', sort) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T@@ -172,7 +172,7 @@ IO Wai.Request toWaiRequest vault port req = do let pathSegments = T.splitOn "/" . T.dropWhile (== '/') $ HalRequest.path req- query = constructQuery $ HalRequest.multiValueQueryStringParameters req+ query = sort . constructQuery $ HalRequest.multiValueQueryStringParameters req hints = NS.defaultHints { NS.addrFlags = [NS.AI_NUMERICHOST],@@ -214,10 +214,11 @@ [] -> "" _ -> renderQuery True query, Wai.requestHeaders =- foldMap- ( \(hName, hValues) ->- (CI.map T.encodeUtf8 hName,) . T.encodeUtf8 <$> hValues- )+ sort+ . foldMap+ ( \(hName, hValues) ->+ (CI.map T.encodeUtf8 hName,) . T.encodeUtf8 <$> hValues+ ) . H.toList $ HalRequest.multiValueHeaders req, Wai.isSecure = True,
test/golden/WaiRequest.txt view
@@ -2,23 +2,15 @@ { requestMethod = "GET" , httpVersion = HTTP/1.1 , rawPathInfo = "/foo/bar/baz"- , rawQueryString = "?PostedBefore=2022-05-31T23%3A16%3A43Z&MaxResultsPerPage=100&PostedAfter=2022-05-31T22%3A16%3A43Z"+ , rawQueryString = "?MaxResultsPerPage=100&PostedAfter=2022-05-31T22%3A16%3A43Z&PostedBefore=2022-05-31T23%3A16%3A43Z" , requestHeaders = [- ( "X-Forwarded-Port"- , "443"- )- ,- ( "Host"- , "ffffffffff.execute-api.us-east-1.amazonaws.com"- )- , ( "accept" , "application/json" ) ,- ( "X-Forwarded-Proto"- , "https"+ ( "Host"+ , "ffffffffff.execute-api.us-east-1.amazonaws.com" ) , ( "User-Agent"@@ -32,6 +24,14 @@ ( "X-Forwarded-For" , "123.123.123.123" )+ ,+ ( "X-Forwarded-Port"+ , "443"+ )+ ,+ ( "X-Forwarded-Proto"+ , "https"+ ) ] , isSecure = True , remoteHost = 123.123.123.123:443@@ -42,16 +42,16 @@ ] , queryString = [- ( "PostedBefore"- , Just "2022-05-31T23:16:43Z"- )- , ( "MaxResultsPerPage" , Just "100" ) , ( "PostedAfter" , Just "2022-05-31T22:16:43Z"+ )+ ,+ ( "PostedBefore"+ , Just "2022-05-31T23:16:43Z" ) ] , requestBody = <IO ByteString>
wai-handler-hal.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: wai-handler-hal-version: 0.1.2.0+version: 0.2.0.0 synopsis: Wrap WAI applications to run on AWS Lambda description: This library provides a function 'Network.Wai.Handler.Hal.run' to@@ -26,6 +26,7 @@ README.md test/data/ProxyRequest.json test/golden/WaiRequest.txt+ tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.2 @@ -40,7 +41,7 @@ common deps build-depends:- , base >=4.12 && <4.17+ , base >=4.12 && <4.18 , base64-bytestring >=1.0.0.0 && <1.3 , bytestring >=0.10.8 && <0.12 , case-insensitive ^>=1.2.0.0@@ -66,7 +67,7 @@ other-modules: Network.Wai.Handler.HalTest build-tool-depends: tasty-discover:tasty-discover ^>=4.2.2 build-depends:- , aeson ^>=1.5.6.0 || ^>=2.0+ , aeson >=1.5.6.0 && <1.6 || >=2.0 && <2.2 , pretty-simple ^>=4.1.0.0 , tasty >=1.3 && <1.5 , tasty-golden ^>=2.3