wai-throttler 0.1.0.3 → 0.1.0.4
raw patch · 3 files changed
+21/−10 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Network/Wai/Middleware/Throttler.hs +3/−3
- changelog.md +14/−3
- wai-throttler.cabal +4/−4
Network/Wai/Middleware/Throttler.hs view
@@ -30,7 +30,7 @@ import Data.Time.Clock (getCurrentTime, UTCTime, NominalDiffTime) import Data.Time.Clock.POSIX (posixSecondsToUTCTime, utcTimeToPOSIXSeconds) import Network.Wai (Request, Response, Middleware, rawPathInfo, responseLBS)-import Network.HTTP.Types.Status (status403)+import Network.HTTP.Types.Status (tooManyRequests429) -- | Cache type class. Throttle cache is used to store request counts. -- Can store multiple counts via different keys. E.g. keys can be client@@ -96,7 +96,7 @@ pathMatches path request = (rawPathInfo request) == path -- | Wai middleware that cuts requests if request rate is higher than defined level.--- Responds with 403 if limit exceeded+-- Responds with 429 if limit exceeded throttle :: ThrottleCache cache => cache -- ^ cache to store request counts -> Int -- ^ request limit@@ -109,4 +109,4 @@ count <- cacheCount cache key if count > limit then return throttledResponse else app req - where throttledResponse = responseLBS status403 [] ""+ where throttledResponse = responseLBS tooManyRequests429 [] ""
changelog.md view
@@ -1,3 +1,14 @@-* 0.1.0.2 - Added changelog-* 0.1.0.1 - Added documentation-* 0.1.0.0 - Initial release+0.1.0.4+* Change HTTP response status code to 429++0.1.0.3+* Update package dependencies versions++0.1.0.2+* Added changelog++0.1.0.1+* Added documentation++0.1.0.0+* Initial release
wai-throttler.cabal view
@@ -1,10 +1,10 @@--- Initial wai-throttler.cabal generated by cabal init. For further +-- Initial wai-throttler.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ name: wai-throttler-version: 0.1.0.3+version: 0.1.0.4 synopsis: Wai middleware for request throttling--- description: +-- description: license: MIT license-file: LICENSE author: Maxim Kulkin@@ -20,7 +20,7 @@ library exposed-modules: Network.Wai.Middleware.Throttler- build-depends: base >=4.6 && <4.8+ build-depends: base >=4.6 && < 5 , bytestring == 0.10.* , containers == 0.5.* , time == 1.4.*