packages feed

freckle-app 1.22.0.0 → 1.23.0.0

raw patch · 4 files changed

+8/−122 lines, 4 filesdep ~freckle-httpPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: freckle-http

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,4 +1,8 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.22.0.0...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.23.0.0...main)++## [v1.23.0.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.22.0.0...freckle-app-v1.23.0.0)++Removes `Freckle.App.HttpSpec` which had been included by mistake.  ## [v1.22.0.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.21.0.0...freckle-app-v1.22.0.0) 
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.22 name:               freckle-app-version:            1.22.0.0+version:            1.23.0.0 license:            MIT license-file:       LICENSE maintainer:         Freckle Education@@ -62,7 +62,6 @@         Freckle.App.Http.Header,         Freckle.App.Http.Paginate,         Freckle.App.Http.Retry,-        Freckle.App.HttpSpec,         Freckle.App.Prelude,         Freckle.App.Exception,         Freckle.App.Exception.MonadThrow,@@ -113,7 +112,7 @@         faktory >=1.1.2.4,         freckle-env >=0.0.1.1,         freckle-exception >=0.0.0.0,-        freckle-http >=0.0.0.0,+        freckle-http >=0.1.0.0,         freckle-otel >=0.0.0.2,         freckle-prelude >=0.0.1.1,         freckle-stats >=0.0.0.0,@@ -200,7 +199,6 @@         Freckle.App.BugsnagSpec         Freckle.App.CsvSpec         Freckle.App.Test.Hspec.AnnotatedExceptionSpec-        Freckle.App.Test.Http.MatchRequestSpec         Freckle.App.Test.Properties.JSONSpec         Freckle.App.Test.Properties.PathPieceSpec         Freckle.App.Test.Properties.PersistValueSpec
package.yaml view
@@ -1,5 +1,5 @@ name: freckle-app-version: 1.22.0.0+version: 1.23.0.0  maintainer: Freckle Education category: Utils@@ -66,7 +66,6 @@     - Freckle.App.Http.Header     - Freckle.App.Http.Paginate     - Freckle.App.Http.Retry-    - Freckle.App.HttpSpec     - Freckle.App.Prelude     - Freckle.App.Exception     - Freckle.App.Exception.MonadThrow
− tests/Freckle/App/Test/Http/MatchRequestSpec.hs
@@ -1,115 +0,0 @@-module Freckle.App.Test.Http.MatchRequestSpec-  ( spec-  ) where--import Freckle.App.Prelude--import Freckle.App.Http-  ( Request-  , addAcceptHeader-  , addRequestHeader-  , parseRequest_-  , setRequestPath-  )-import Freckle.App.Test.Http.MatchRequest-import Network.HTTP.Types.Header (hAccept)-import Test.Hspec--spec :: Spec-spec = do-  describe "matchRequestFromUrl" $ do-    context "matching complete requests" $ do-      let-        url = "https://localhost:3000/hello?world"-        mr = matchRequestFromUrl url--      it "matches the same request" $ do-        mr `shouldMatchRequest` parseRequest_ url--      it "matches on path, even if built relative" $ do-        let req = parseRequest_ "https://localhost:3000/world?world"-        mr `shouldMatchRequest` setRequestPath "hello" req--      it "matches on method" $ do-        mr `shouldNotMatchRequest` parseRequest_ ("POST " <> url)--      it "matches on scheme" $ do-        mr `shouldNotMatchRequest` parseRequest_ "http://localhost:3000/hello?world"--      it "matches on host" $ do-        mr `shouldNotMatchRequest` parseRequest_ "https://localhost2:3000/hello?world"--      it "matches on port" $ do-        mr `shouldNotMatchRequest` parseRequest_ "https://localhost:3001/hello?world"--      it "matches on path" $ do-        mr `shouldNotMatchRequest` parseRequest_ "https://localhost:3000/world?world"--      it "matches on query" $ do-        mr `shouldNotMatchRequest` parseRequest_ "https://localhost:3000/hello?wut"--    it "can match on everything unspecified" $ do-      let mr = matchRequestFromUrl "https://"--      mr `shouldMatchRequest` parseRequest_ "https://example.com"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/foo"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/bar"--    it "can match any path" $ do-      let mr = matchRequestFromUrl "https://example.com"--      mr `shouldMatchRequest` parseRequest_ "https://example.com"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/foo"-      mr `shouldMatchRequest` parseRequest_ "https://example.com/bar"--    it "can match the root path explicitly" $ do-      let mr = matchRequestFromUrl "https://example.com/"--      mr `shouldMatchRequest` parseRequest_ "https://example.com/"-      mr `shouldMatchRequest` parseRequest_ "https://example.com"-      mr `shouldNotMatchRequest` parseRequest_ "https://example.com/foo"-      mr `shouldNotMatchRequest` parseRequest_ "https://example.com/bar"--    context "matching headers" $ do-      let-        url = "https://example.com/"-        accept = "text/plain"-        hasNoHeaders = parseRequest_ url-        hasOnlyTheHeader = addAcceptHeader accept hasNoHeaders-        hasExtraHeaders = addRequestHeader "User-Agent" "me" hasOnlyTheHeader--      it "can match headers exactly" $ do-        let mr = matchRequestFromUrl url <> MatchHeaders [(hAccept, accept)]--        mr `shouldMatchRequest` hasOnlyTheHeader-        mr `shouldNotMatchRequest` hasExtraHeaders-        mr `shouldNotMatchRequest` hasNoHeaders--      it "can match headers-include" $ do-        let mr = matchRequestFromUrl url <> MatchHeader (hAccept, accept)--        mr `shouldMatchRequest` hasOnlyTheHeader-        mr `shouldMatchRequest` hasExtraHeaders-        mr `shouldNotMatchRequest` hasNoHeaders--shouldMatchRequest :: HasCallStack => MatchRequest -> Request -> IO ()-mr `shouldMatchRequest` req = do-  case matchRequest req mr of-    Left err -> do-      let preamble = unlines ["Expected to match request, but did not", "", show req]-      expectationFailure $ preamble <> err-    Right () -> pure ()--infix 1 `shouldMatchRequest`--shouldNotMatchRequest :: HasCallStack => MatchRequest -> Request -> IO ()-mr `shouldNotMatchRequest` req = do-  case matchRequest req mr of-    Left {} -> pure ()-    Right () -> do-      let preamble = unlines ["Expected to NOT match request, but did", "", show req]-      expectationFailure $ preamble <> showMatchRequest mr--infix 1 `shouldNotMatchRequest`