1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-08-31 03:20:20 +02:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
GreeFine
2023-09-01 11:09:04 +02:00
49 changed files with 518 additions and 397 deletions

View File

@@ -2,28 +2,30 @@
## Unreleased - 2022-xx-xx
- Added optional scopes to the middleware enabling use of multiple Limiters by passing an `HashMap<Limiter>` to the Http server `app_data`
- Update `redis` dependency to `0.22`.
## 0.4.0 - 2022-09-10
- Add `Builder::key_by` for setting a custom rate limit key function.
- Implement `Default` for `RateLimiter`.
- `RateLimiter` is marked `#[non_exhaustive]`; use `RateLimiter::default()` instead.
- In the middleware errors from the count function are matched and respond with `INTERNAL_SERVER_ERROR` if it's an unexpected error, instead of the default `TOO_MANY_REQUESTS`.
- Minimum supported Rust version (MSRV) is now 1.59 due to transitive `time` dependency.
## 0.3.0 - 2022-07-11
- `Limiter::builder` now takes an `impl Into<String>`.
- Removed lifetime from `Builder`.
- Updated `actix-session` dependency to `0.7`.
## 0.2.0 - 2022-03-22
- Update Actix Web dependency to v4 ecosystem.
- Update Tokio dependencies to v1 ecosystem.
- Rename `Limiter::{build => builder}()`.
- Rename `Builder::{finish => build}()`.
- Exceeding the rate limit now returns a 429 Too Many Requests response.
## 0.1.4 - 2022-03-18
- Adopted into @actix org from <https://github.com/0xmad/actix-limitation>.

View File

@@ -11,6 +11,11 @@ categories = ["asynchronous", "web-programming"]
repository = "https://github.com/actix/actix-extras.git"
license = "MIT OR Apache-2.0"
edition = "2018"
rust-version = "1.60"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
all-features = true
[features]
default = ["session"]
@@ -21,9 +26,9 @@ actix-utils = "3"
actix-web = { version = "4", features = ["cookies"] }
chrono = "0.4"
derive_more = "0.99.5"
derive_more = "0.99.7"
log = "0.4"
redis = { version = "0.21", default-features = false, features = ["tokio-comp"] }
redis = { version = "0.22", default-features = false, features = ["tokio-comp"] }
time = "0.3"
# session

View File

@@ -21,7 +21,7 @@ async fn test_limiter_count() -> Result<(), Error> {
for i in 0..20 {
let status = limiter.count(id.to_string()).await?;
println!("status: {:?}", status);
println!("status: {status:?}");
assert_eq!(20 - status.remaining(), i + 1);
}